public function BlockForm::validateForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::validateForm()
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 283 - Contains \Drupal\block\BlockForm.
Class
- BlockForm
- Provides form for block instance forms.
Namespace
Drupal\blockCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// The Block Entity form puts all block plugin form elements in the
// settings form element, so just pass that to the block for validation.
$settings = (new FormState())
->setValues($form_state
->getValue('settings'));
// Call the plugin validate handler.
$this->entity
->getPlugin()
->validateConfigurationForm($form, $settings);
// Update the original form values.
$form_state
->setValue('settings', $settings
->getValues());
$this
->validateVisibility($form, $form_state);
}