You are here

function environment_indicator_navbar in Environment Indicator 7.2

Implements hook_navbar().

File

./environment_indicator.module, line 361
Module implementation file.

Code

function environment_indicator_navbar() {
  $integrations = variable_get('environment_indicator_integration', array(
    'toolbar' => 'toolbar',
    'admin_menu' => 'admin_menu',
    'navbar' => 'navbar',
  ));
  if (empty($integrations['navbar'])) {
    return;
  }
  $environment_info = environment_indicator_get_active();
  if (!empty($environment_info) && environment_indicator_check_access($environment_info)) {
    $items['environment_indicator'] = array(
      '#type' => 'navbar_item',
      'tab' => array(
        '#type' => 'link',
        '#title' => $environment_info['name'] . (!empty($environment_info['git_branch']) ? ' - ' . $environment_info['git_branch'] : ''),
        '#href' => '',
        '#options' => array(
          'attributes' => array(
            'title' => t('Environments'),
            'class' => array(
              'navbar-icon',
              'navbar-icon-environment',
            ),
          ),
        ),
      ),
      '#weight' => 125,
      'tray' => _environment_indicator_switcher_menu(),
    );
    return $items;
  }
}