You are here

function alpha_pagination_tokens in Views Alpha Pagination 8.2

Same name and namespace in other branches
  1. 7.2 alpha_pagination.module \alpha_pagination_tokens()

Implements hook_tokens().

See also

\views_handler_area_alpha_pagination::getTokens()

File

./alpha_pagination.module, line 91
Module hooks and alters for the Views Alpha Pagination module.

Code

function alpha_pagination_tokens($type, $tokens, array $data = [], array $options = []) {
  $sanitize = !empty($options['sanitize']);
  $replacements = [];
  if ($type === 'alpha_pagination' && !empty($data['alpha_pagination']) && ($alpha_pagination = $data['alpha_pagination'])) {
    foreach ($tokens as $name => $original) {
      if (isset($alpha_pagination[$name])) {
        $replacements[$original] = $sanitize ? Html::escape($alpha_pagination[$name]) : $alpha_pagination[$name];
      }
    }
  }
  return $replacements;
}