/** * 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; }
/** * {@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; }
/** * {@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(); }
/** * {@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(); }
/** * {@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())))); }
/** * {@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; }
/** * {@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())))); }