You are here

function theme_domain_nav_default in Domain Access 7.3

Same name and namespace in other branches
  1. 5 domain_nav/domain_nav.module \theme_domain_nav_default()
  2. 6.2 domain_nav/domain_nav.module \theme_domain_nav_default()
  3. 7.2 domain_nav/domain_nav.module \theme_domain_nav_default()

Themes the domain list as a JavaScript selection form.

Parameters

$variables: An array of information about each domain. Options contain the following:

  • domain_id -- the unique identifier of this domain
  • subdomain -- the host path of the url for this domain
  • sitename -- the human-readable name of this domain
  • path -- the link path (a Drupal-formatted path)
  • active -- a boolean flag indicating the currently active domain

If hook_domain_nav() is invoked, additonal elements may be present.

File

domain_nav/domain_nav.module, line 250
Navigation block and menu options for Domain Access

Code

function theme_domain_nav_default($variables) {
  $_domain = domain_get_domain();
  $options = $variables['options'];
  $current = $options[$_domain['domain_id']];
  $output = '<form class="domain-list" action=""><div class="domain-pointless-validator-class">';
  $output .= '<select onchange="if (this.value) location.href=this.value;">';
  $output .= '<option value="' . $current['path'] . '">' . t('Jump to...') . '</option>';
  foreach ($options as $key => $value) {
    isset($value['active']) ? $selected = ' selected="selected"' : ($selected = '');
    $output .= '<option value="' . $value['path'] . '"' . $selected . '>' . filter_xss_admin($value['sitename']) . '</option>';
  }
  $output .= '</select>';
  $output .= '</div></form>';
  return $output;
}