當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityForm::submit方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityForm::submit方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityForm::submit方法的具體用法?PHP EntityForm::submit怎麽用?PHP EntityForm::submit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityForm的用法示例。


在下文中一共展示了EntityForm::submit方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: submit

 /**
  * Overrides EntityForm::submit().
  */
 public function submit(array $form, array &$form_state)
 {
     // Build the menu link object from the submitted values.
     $menu_link = parent::submit($form, $form_state);
     // The value of "hidden" is the opposite of the value supplied by the
     // "enabled" checkbox.
     $menu_link->hidden = (int) (!$menu_link->enabled);
     unset($menu_link->enabled);
     $menu_link->options['attributes']['title'] = $menu_link->description;
     list($menu_link->menu_name, $menu_link->plid) = explode(':', $menu_link->parent);
     return $menu_link;
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:15,代碼來源:MenuLinkForm.php

示例2: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     parent::submit($form, $form_state);
     if ($this->plugin instanceof PluginFormInterface) {
         $this->plugin->submitConfigurationForm($form, $form_state);
     }
     return $this->entity;
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:11,代碼來源:SearchPageFormBase.php

示例3: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, array &$form_state)
 {
     $form_state['redirect_route']['route_name'] = 'system.date_format_list';
     $form_state['values']['pattern'] = trim($form_state['values']['date_format_pattern']);
     parent::submit($form, $form_state);
     $this->entity->save();
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:10,代碼來源:DateFormatFormBase.php

示例4: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $form_state->setRedirect('system.date_format_list');
     $form_state['values']['pattern'] = trim($form_state['values']['date_format_pattern']);
     parent::submit($form, $form_state);
     $this->entity->save();
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:10,代碼來源:DateFormatFormBase.php

示例5: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, array &$form_state)
 {
     parent::submit($form, $form_state);
     $entity = $this->entity;
     // The Block Entity form puts all block plugin form elements in the
     // settings form element, so just pass that to the block for submission.
     // @todo Find a way to avoid this manipulation.
     $settings = array('values' => &$form_state['values']['settings'], 'errors' => $form_state['errors']);
     // Call the plugin submit handler.
     $entity->getPlugin()->submitConfigurationForm($form, $settings);
     // Save the settings of the plugin.
     $entity->save();
     drupal_set_message($this->t('The block configuration has been saved.'));
     $form_state['redirect_route'] = array('route_name' => 'block.admin_display_theme', 'route_parameters' => array('theme' => $form_state['values']['theme']), 'options' => array('query' => array('block-placement' => drupal_html_class($this->entity->id()))));
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:18,代碼來源:BlockForm.php

示例6: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, array &$form_state)
 {
     parent::submit($form, $form_state);
     // Add the submitted form values to the text format, and save it.
     $format = $this->entity;
     foreach ($form_state['values'] as $key => $value) {
         if ($key != 'filters') {
             $format->set($key, $value);
         } else {
             foreach ($value as $instance_id => $config) {
                 $format->setFilterConfig($instance_id, $config);
             }
         }
     }
     $format->save();
     // Save user permissions.
     if ($permission = $format->getPermissionName()) {
         foreach ($form_state['values']['roles'] as $rid => $enabled) {
             user_role_change_permissions($rid, array($permission => $enabled));
         }
     }
     $form_state['redirect_route']['route_name'] = 'filter.admin_overview';
     return $this->entity;
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:27,代碼來源:FilterFormatFormBase.php

示例7: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     parent::submit($form, $form_state);
     $entity = $this->entity;
     // The Block Entity form puts all block plugin form elements in the
     // settings form element, so just pass that to the block for submission.
     // @todo Find a way to avoid this manipulation.
     $settings = new FormState(array('values' => $form_state['values']['settings']));
     // Call the plugin submit handler.
     $entity->getPlugin()->submitConfigurationForm($form, $settings);
     // Update the original form values.
     $form_state['values']['settings'] = $settings['values'];
     // Save the settings of the plugin.
     $entity->save();
     drupal_set_message($this->t('The block configuration has been saved.'));
     $form_state->setRedirect('block.admin_display_theme', array('theme' => $form_state['values']['theme']), array('query' => array('block-placement' => drupal_html_class($this->entity->id()))));
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:20,代碼來源:BlockForm.php


注:本文中的Drupal\Core\Entity\EntityForm::submit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。