You are here

public function FooTable::validateOptionsForm in FooTable 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/style/FooTable.php \Drupal\footable\Plugin\views\style\FooTable::validateOptionsForm()

Validate the options form.

Overrides StylePluginBase::validateOptionsForm

File

src/Plugin/views/style/FooTable.php, line 390

Class

FooTable
Style plugin to render a table as a FooTable.

Namespace

Drupal\footable\Plugin\views\style

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
  parent::validateOptionsForm($form, $form_state);
  $breakpoints = FALSE;
  foreach ($form_state
    ->getValue([
    'style_options',
    'footable',
    'breakpoint',
  ], []) as $breakpoint) {
    if (!empty(array_filter($breakpoint))) {
      $breakpoints = TRUE;
      break;
    }
  }
  if (!$breakpoints) {
    $form_state
      ->setErrorByName('style_options][footable][breakpoint', $this
      ->t('You need to have atleast one column that has a breakpoint.'));
  }
}