function language_negotiation_get_switch_links
language_negotiation_get_switch_links($type, $path)
Returns the language switch links for the given language.
Parameters
$type: The language negotiation type.
$path: The internal path the switch links will be relative to.
Return value
A keyed array of links ready to be themed.
Related topics
File
- includes/language.inc, line 279
- Language Negotiation API.
Code
function language_negotiation_get_switch_links($type, $path) { $links = FALSE; $negotiation = variable_get("language_negotiation_$type", array()); // Only get the languages if we have more than one. if (count(language_list()) >= 2) { $language = language_initialize($type); } foreach ($negotiation as $id => $provider) { if (isset($provider['callbacks']['switcher'])) { if (isset($provider['file'])) { require_once DRUPAL_ROOT . '/' . $provider['file']; } $callback = $provider['callbacks']['switcher']; $result = $callback($type, $path); // Add support for WCAG 2.0's Language of Parts to add language identifiers. // http://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html foreach ($result as $langcode => $link) { $result[$langcode]['attributes']['xml:lang'] = $langcode; } if (!empty($result)) { // Allow modules to provide translations for specific links. drupal_alter('language_switch_links', $result, $type, $path); $links = (object) array('links' => $result, 'provider' => $id); break; } } } return $links; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!language.inc/function/language_negotiation_get_switch_links/7.x