You are here

public function ShowMore::validateOptionsForm in Views Show More 8

Options form validate.

Overrides SqlBase::validateOptionsForm

File

src/Plugin/views/pager/ShowMore.php, line 245

Class

ShowMore
The plugin to handle show more pager.

Namespace

Drupal\views_show_more\Plugin\views\pager

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
  $effect_speed = $form_state
    ->getValue([
    'pager_options',
    'effects',
    'speed_type',
  ]);
  $effect_speed_val = $form_state
    ->getValue([
    'pager_options',
    'effects',
    'speed_value',
  ]);
  if ($effect_speed == 'custom') {
    if ($effect_speed_val == '') {
      $form_state
        ->setErrorByName('pager_options][effects][speed_value', $this
        ->t('Animation speed is required.'));
    }
    else {
      $form_state
        ->setValue([
        'pager_options',
        'effects',
        'speed',
      ], $effect_speed_val);
    }
  }
  else {
    $form_state
      ->setValue([
      'pager_options',
      'effects',
      'speed',
    ], $effect_speed);
  }
}