当前位置: 首页>>代码示例>>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;未经允许,请勿转载。