function BlockForm::validateForm

Same name in other branches
  1. 9 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::validateForm()
  2. 8.9.x core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::validateForm()
  3. 10 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::validateForm()

Overrides FormBase::validateForm

File

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

Class

BlockForm
Provides form for block instance forms.

Namespace

Drupal\block

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form, $form_state);
    $form_state->setValue('weight', (int) $form_state->getValue('weight'));
    // The Block Entity form puts all block plugin form elements in the
    // settings form element, so just pass that to the block for validation.
    $this->getPluginForm($this->entity
        ->getPlugin())
        ->validateConfigurationForm($form['settings'], SubformState::createForSubform($form['settings'], $form, $form_state));
    $this->validateVisibility($form, $form_state);
}

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