You are here

public function ViewsLayoutStyle::validateRegions in Views Layout 8

Form element validation handler for buildOptionsForm().

File

src/Plugin/views/style/ViewsLayoutStyle.php, line 198

Class

ViewsLayoutStyle
Style plugin for the timeline view.

Namespace

Drupal\views_layout\Plugin\views\style

Code

public function validateRegions($element, FormStateInterface $form_state) {
  $plugin_id = $element['layout_name']['#value'];
  if (empty($plugin_id)) {
    $form_state
      ->setError($element['layout_name'], $this
      ->t('A layout must be selected.'));
  }
  elseif (empty($element['layout_regions'][$plugin_id]['#value'])) {
    $form_state
      ->setError($element['layout_regions'][$plugin_id], $this
      ->t('At least one region must be selected.'));
  }
}