You are here

function theme_environment_indicator_indicator_name in Environment Indicator 8.2

Same name and namespace in other branches
  1. 7.2 environment_indicator.theme.inc \theme_environment_indicator_indicator_name()

Theme function for the indicator name.

3 theme calls to theme_environment_indicator_indicator_name()
environment_indicator_admin_menu_output_alter in ./environment_indicator.module
Implements hook_admin_menu_output_alter().
environment_indicator_page_build in ./environment_indicator.module
Implements hook_page_build().
theme_environment_indicator_indicator_bar in ./environment_indicator.theme.inc
Theme function for the indicator bar.

File

./environment_indicator.theme.inc, line 11
Theme implementation file.

Code

function theme_environment_indicator_indicator_name($variables) {
  $output = '<div class="environment-indicator-name">' . t($variables['name']) . '</div>';
  $environments = environment_indicator_get_all(TRUE);
  $active_environment = environment_indicator_get_active();
  foreach ($environments as $machine => $environment) {
    if ($machine != $active_environment['machine']) {
      $items[] = array(
        'link' => array(
          '#type' => 'link',
          '#title' => t('Open in %name', array(
            '%name' => t($environment
              ->label()),
          )),
          '#href' => 'http://' . $environment
            ->get('regexurl') . '/' . current_path(),
          '#options' => array(
            'html' => TRUE,
          ),
        ),
        '#wrapper_attributes' => array(
          'class' => array(
            'environment-switcher',
          ),
        ),
      );
    }
  }
  if (!empty($items)) {
    $switcher = array(
      '#theme' => 'item_list',
      '#items' => $items,
      '#attributes' => array(
        'class' => array(
          'environment-switcher-container',
        ),
      ),
    );
    $output .= drupal_render($switcher);
  }
  return $output;
}