You are here

public function TokensDateFilterTrait::validateExposed in Tokens in Views Filter Criteria 8

File

src/TokensDateFilterTrait.php, line 32

Class

TokensDateFilterTrait
Trait for Tokens Date Filter.

Namespace

Drupal\token_views_filter

Code

public function validateExposed(&$form, FormStateInterface $form_state) {

  // Replace tokens to validate date.
  $options = $form_state
    ->getValue('options');
  $value =& $options['value'];
  $original_value = $value;
  $this
    ->replaceTokens($value);
  $form_state
    ->setValue('options', $options);
  parent::validateExposed($form, $form_state);

  // Restore tokens to use it in filters.
  $options['value'] = $original_value;
  $form_state
    ->setValue('options', $options);
}