You are here

function theme_domain_nav_default in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_nav/domain_nav.module \theme_domain_nav_default()
  2. 7.3 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

$options: 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_domainnav() is invoked, additonal elements may be present.

File

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

Code

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