function BlockForm::save

Same name and namespace in other branches
  1. 11.x core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::save()

Overrides EntityForm::save

File

core/modules/block/src/BlockForm.php, line 361

Class

BlockForm
Provides form for block instance forms.

Namespace

Drupal\block

Code

public function save(array $form, FormStateInterface $form_state) {
  $value = parent::save($form, $form_state);
  $this->messenger()
    ->addStatus($this->t('The block configuration has been saved.'));
  $form_state->setRedirect('block.admin_display_theme', [
    'theme' => $form_state->getValue('theme'),
  ], [
    'query' => [
      'block-placement' => Html::getClass($this->entity
        ->id()),
    ],
  ]);
  return $value;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.