You are here

function pathauto_i18n_tokens_alter in Pathauto i18n 8

Same name and namespace in other branches
  1. 7 pathauto_i18n.module \pathauto_i18n_tokens_alter()

Implements hook_tokens_alter().

File

./pathauto_i18n.module, line 236
Provides common functions and callbacks for pathauto_i18n submodules.

Code

function pathauto_i18n_tokens_alter(&$replacements, array $context) {

  // @todo need tests.
  if (!empty($context['options']['pathauto'])) {
    foreach ($context['tokens'] as $name => $original) {
      if (!empty($replacements[$original]) && !empty($context['options']['language']->language) && $context['options']['language']->language != LANGUAGE_NONE) {
        $replacements[$original] = pathauto_i18n_cleanstring($context['options']['language']->language, $replacements[$original]);
      }
    }
  }
}