You are here

function languageicons_link_add in Language Icons 8

Same name and namespace in other branches
  1. 6.2 languageicons.module \languageicons_link_add()
  2. 6 languageicons.module \languageicons_link_add()
  3. 7 languageicons.module \languageicons_link_add()

Add language icon to link.

The language icon may be a different language as the destination page, can be passed in 'language_icon'.

1 call to languageicons_link_add()
languageicons_language_switch_links_alter in ./languageicons.module
Implements hook_language_switch_links_alter().

File

./languageicons.module, line 76
Main functions and hook implementations for the Language Icons module.

Code

function languageicons_link_add(&$link, $title = NULL) {
  $link['title'] = [
    '#theme' => 'languageicons_link_content',
    '#language' => isset($link['language_icon']) ? $link['language_icon'] : $link['language'],
    '#text' => $link['title'],
    '#title' => $title ? $title : $link['title'],
  ];
  $link['html'] = TRUE;
}