function BlockContentForm::actions

Same name and namespace in other branches
  1. 10 core/modules/block_content/src/BlockContentForm.php \Drupal\block_content\BlockContentForm::actions()

Overrides EntityForm::actions

File

core/modules/block_content/src/BlockContentForm.php, line 44

Class

BlockContentForm
Form handler for the content block edit forms.

Namespace

Drupal\block_content

Code

protected function actions(array $form, FormStateInterface $form_state) : array {
    $element = parent::actions($form, $form_state);
    if ($this->getRequest()->query
        ->has('theme')) {
        $element['submit']['#value'] = $this->t('Save and configure');
    }
    if ($this->currentUser()
        ->hasPermission('administer blocks') && !$this->getRequest()->query
        ->has('theme') && $this->entity
        ->isNew()) {
        $element['configure_block'] = [
            '#type' => 'submit',
            '#value' => $this->t('Save and configure'),
            '#weight' => 20,
            '#submit' => array_merge($element['submit']['#submit'], [
                '::configureBlock',
            ]),
        ];
    }
    return $element;
}

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