本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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();
}
示例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()))));
}
示例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;
}
示例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()))));
}