You are here

function environment_indicator_page_build in Environment Indicator 7.2

Same name and namespace in other branches
  1. 8.2 environment_indicator.module \environment_indicator_page_build()

Implements hook_page_build().

File

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

Code

function environment_indicator_page_build(&$page) {
  if ($match = environment_indicator_get_active()) {
    if (environment_indicator_check_access($match)) {
      $js_settings = array(
        'environment_indicator' => array(
          'addFavicon' => variable_get('environment_indicator_favicon_overlay', TRUE),
          // Get the first letter out of the name.
          'faviconLabel' => $match['name'][0],
          'faviconColor' => $match['color'],
          'faviconTextColor' => $match['text_color'],
        ),
      );
      if (environment_indicator_needs_js()) {
        $js_settings['environment_indicator']['toolbar-color'] = $match['color'];
        $js_settings['environment_indicator']['toolbar-text-color'] = $match['text_color'];
        $js_settings['environment_indicator']['environment-indicator-name'] = theme('environment_indicator_indicator_name', $match);
      }
      else {
        environment_indicator_attach_indicator($match, $page);
      }
      drupal_add_js($js_settings, 'setting');
      drupal_add_js(drupal_get_path('module', 'environment_indicator') . '/tinycon.min.js', array(
        'every_page' => TRUE,
      ));
      drupal_add_js(drupal_get_path('module', 'environment_indicator') . '/environment_indicator.js', array(
        'every_page' => TRUE,
      ));
      drupal_add_js(drupal_get_path('module', 'environment_indicator') . '/color.js', array(
        'every_page' => TRUE,
      ));
      drupal_add_css(drupal_get_path('module', 'environment_indicator') . '/environment_indicator.css', array(
        'every_page' => TRUE,
      ));
    }
  }
}