public function BlockFormController::submit

Overrides \Drupal\Core\Entity\EntityFormController::submit().

Overrides EntityFormController::submit

File

drupal/core/modules/block/lib/Drupal/block/BlockFormController.php, line 217
Contains \Drupal\block\BlockFormController.

Class

BlockFormController
Provides form controller for block instance forms.

Namespace

Drupal\block

Code

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.
  $settings = array(
    'values' => &$form_state['values']['settings'],
  );

  // Call the plugin submit handler.
  $entity
    ->getPlugin()
    ->submit($form, $settings);

  // Save the settings of the plugin.
  $entity
    ->save();
  drupal_set_message(t('The block configuration has been saved.'));
  cache_invalidate_tags(array(
    'content' => TRUE,
  ));
  $form_state['redirect'] = 'admin/structure/block/list/block_plugin_ui:' . $entity
    ->get('theme');
}