TokensDateFilterTrait.php in Tokens in Views Filter Criteria 8
File
src/TokensDateFilterTrait.php
View source
<?php
namespace Drupal\token_views_filter;
use Drupal\Core\Form\FormStateInterface;
trait TokensDateFilterTrait {
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
$options = $form_state
->getValue('options');
$value =& $options['value'];
$original_value = $value;
$this
->replaceTokens($value);
$form_state
->setValue('options', $options);
parent::validateOptionsForm($form, $form_state);
$options['value'] = $original_value;
$form_state
->setValue('options', $options);
}
public function validateExposed(&$form, FormStateInterface $form_state) {
$options = $form_state
->getValue('options');
$value =& $options['value'];
$original_value = $value;
$this
->replaceTokens($value);
$form_state
->setValue('options', $options);
parent::validateExposed($form, $form_state);
$options['value'] = $original_value;
$form_state
->setValue('options', $options);
}
}