You are here

public function PanelsBlockConfigureFormBase::validateForm in Panels 8.4

Same name and namespace in other branches
  1. 8.3 src/Form/PanelsBlockConfigureFormBase.php \Drupal\panels\Form\PanelsBlockConfigureFormBase::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/PanelsBlockConfigureFormBase.php, line 151

Class

PanelsBlockConfigureFormBase
Provides a base form for configuring a block as part of a variant.

Namespace

Drupal\panels\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // The page might have been serialized, resulting in a new variant
  // collection. Refresh the block object.
  $this->block = $this
    ->getVariantPlugin()
    ->getBlock($form_state
    ->get('block_id'));
  $settings = (new FormState())
    ->setValues($form_state
    ->getValue('settings'));

  // Call the plugin validate handler.
  $this->block
    ->validateConfigurationForm($form, $settings);

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