You are here

environment_indicator.theme.inc in Environment Indicator 8.2

Same filename and directory in other branches
  1. 7.2 environment_indicator.theme.inc

Theme implementation file.

File

environment_indicator.theme.inc
View source
<?php

/**
 * @file
 * Theme implementation file.
 */

/**
 * Theme function for the indicator name.
 */
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;
}

/**
 * Theme function for the indicator bar.
 */
function theme_environment_indicator_indicator_bar($variables) {
  $info = $variables['info'];
  $output = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        drupal_html_class('environment-indicator-' . $info['machine']),
        'position-' . $info['position'],
        'fixed-' . ($info['fixed'] ? 'yes' : 'no'),
      ),
      'id' => 'environment-indicator',
      'style' => 'background-color: ' . $info['color'],
    ),
    'name' => array(
      '#theme' => 'environment_indicator_indicator_name',
      '#name' => $info,
      '#prefix' => '<div class="gradient-bar">',
      '#suffix' => '</div>',
    ),
  );
  return drupal_render($output);
}

Functions

Namesort descending Description
theme_environment_indicator_indicator_bar Theme function for the indicator bar.
theme_environment_indicator_indicator_name Theme function for the indicator name.