public function BlockFieldConfigForm::validateForm in Display Suite 8.4
Same name and namespace in other branches
- 8.2 src/Form/BlockFieldConfigForm.php \Drupal\ds\Form\BlockFieldConfigForm::validateForm()
- 8.3 src/Form/BlockFieldConfigForm.php \Drupal\ds\Form\BlockFieldConfigForm::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
- src/
Form/ BlockFieldConfigForm.php, line 103
Class
- BlockFieldConfigForm
- Configure block fields.
Namespace
Drupal\ds\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$field = $this->field;
// Create an instance of the block.
/* @var $block BlockPluginInterface */
$manager = \Drupal::service('plugin.manager.block');
$block_id = $field['properties']['block'];
$block = $manager
->createInstance($block_id);
// Validate block config data using the block's validation handler.
$block
->validateConfigurationForm($form, $form_state);
}