You are here

public function PanelsIPEBlockPluginForm::validateForm in Panels 8.3

Same name and namespace in other branches
  1. 8.4 panels_ipe/src/Form/PanelsIPEBlockPluginForm.php \Drupal\panels_ipe\Form\PanelsIPEBlockPluginForm::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

panels_ipe/src/Form/PanelsIPEBlockPluginForm.php, line 228

Class

PanelsIPEBlockPluginForm
Provides a form for adding a block plugin temporarily using AJAX.

Namespace

Drupal\panels_ipe\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $block_instance = $this
    ->getBlockInstance($form_state);

  // Validate the block configuration form.
  $block_form_state = (new FormState())
    ->setValues($form_state
    ->getValue('settings'));
  $block_instance
    ->validateConfigurationForm($form, $block_form_state);

  // Update the original form values.
  $form_state
    ->setValue('settings', $block_form_state
    ->getValues());
}