You are here

function theme_environment_indicator_indicator_name in Environment Indicator 7.2

Same name and namespace in other branches
  1. 8.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 27
Theme implementation file.

Code

function theme_environment_indicator_indicator_name($variables) {
  $title = t('You are seeing the @name environment', array(
    '@name' => t($variables['name']),
  ));
  $branch_html = '';
  if (!empty($variables['git_branch'])) {
    $branch_html = '<span class="git-branch"> - ' . $variables['git_branch'] . '</span>';
    $title = t('GIT is running @branch branch in this environment.', array(
      '@branch' => $variables['git_branch'],
    ));
  }
  $output = '<div class="environment-indicator-name" title="' . $title . '">' . t($variables['name']) . $branch_html . '</div>';
  $environments = environment_indicator_get_all(TRUE);
  if (!empty($environments)) {
    foreach ($environments as $environment) {
      $items[] = array(
        'data' => l(t('Open in %name', array(
          '%name' => t($environment->name),
        )), 'http://' . $environment->regexurl . '/' . current_path(), array(
          'html' => TRUE,
        )),
      );
    }
    $switcher = theme('environment_indicator_switches', array(
      'switches' => $items,
    ));
    $output .= $switcher;
  }
  return $output;
}