You are here

public function TokensDateTimeFilter::replaceTokens in Tokens in Views Filter Criteria 8

Replace tokens in filters.

Parameters

mixed $value: Array of values `min`, `max` and `value` or just value.

Overrides TokenViewsFilterPluginInterface::replaceTokens

File

src/Plugin/views/filter/token/TokensDateTimeFilter.php, line 25

Class

TokensDateTimeFilter
Extending if basic datetime filter to use tokens as value.

Namespace

Drupal\token_views_filter\Plugin\views\filter\token

Code

public function replaceTokens(&$value) {
  $data = [
    'view' => $this->view,
  ];
  $value_keys = [
    'value',
    'min',
    'max',
  ];
  foreach ($value_keys as $key) {
    if (isset($value[$key])) {
      $value[$key] = $this->token
        ->replace($value[$key], $data, [
        'clear' => TRUE,
      ]);
    }
  }
}