BlockForm::validateForm

public BlockForm::validateForm(array &$form, FormStateInterface $form_state)

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

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

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);
}
doc_Drupal
2016-10-29 08:47:33
Comments
Leave a Comment

Please login to continue.