You are here

public function LayoutChangeRegions::validateForm in Panels 8.3

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

Class

LayoutChangeRegions
Provides a form for mapping old regions into the regions of a new layout.

Namespace

Drupal\panels\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('blocks') as $old_region => $values) {
    if ($values['region'] == '__unassigned__') {
      $form_state
        ->setErrorByName('blocks][' . $old_region, $this
        ->t('You must assign your old regions to an available new region.'));
    }
  }
}