language_negotiation_get_switch_links

7 language.inc language_negotiation_get_switch_links($type, $path)
8 language.inc language_negotiation_get_switch_links($type, $path)

Return 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.

3 calls to language_negotiation_get_switch_links()

File

includes/language.inc, line 189
Multiple language handling functionality.

Code

function language_negotiation_get_switch_links($type, $path) {
  $links = FALSE;
  $negotiation = variable_get("language_negotiation_$type", array());

  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);

      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;
}
Login or register to post comments