You are here

public function BlockFieldConfigForm::validateForm in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Form/BlockFieldConfigForm.php \Drupal\ds\Form\BlockFieldConfigForm::validateForm()
  2. 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 99

Class

BlockFieldConfigForm
Configure block fields.

Namespace

Drupal\ds\Form

Code

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);
}