You are here

function external_hreflang_token_info in External Hreflang 8

Implements hook_token_info().

File

./external_hreflang.tokens.inc, line 14
Token related functions for the external_hreflang.

Code

function external_hreflang_token_info() {
  $info = [];
  $languages = \Drupal::languageManager()
    ->getLanguages();
  foreach ($languages as $language) {
    $args = [
      '@language' => $language
        ->getName(),
    ];
    $info['tokens']['current-page']['url']['relative'][$language
      ->getId()] = [
      'name' => t('URL in @name', $args),
      'description' => t('Relative URL of the current page in @language without language prefix.', $args),
    ];
  }
  return $info;
}