You are here

function outdatedbrowser_page_build in Outdated Browser 7

Implements hook_page_build().

Adds the necessary #outdated div element to the page_bottom region and loads the necessary CSS and JS files.

File

./outdatedbrowser.module, line 102
Outdated Browser module file.

Code

function outdatedbrowser_page_build(&$page) {
  if (path_is_admin(current_path())) {
    return;
  }
  $page['page_bottom']['outdatedbrowser'] = array(
    '#markup' => '<div id="outdated"></div>',
  );
  $variant = variable_get('outdatedbrowser_compression_type', 'minified');
  $library = libraries_load('outdatedbrowser', $variant);
  if ($library['installed']) {
    $module_path = drupal_get_path('module', 'outdatedbrowser');
    $page['page_bottom']['#attached']['js'][] = array(
      'data' => $module_path . '/js/outdatedbrowser.js',
    );
    $js_settings = array(
      'bgColor' => variable_get('outdatedbrowser_bgcolor', '#f25648'),
      'color' => variable_get('outdatedbrowser_color', '#ffffff'),
      'lowerThan' => variable_get('outdatedbrowser_lowerthan', 'transform'),
      'languagePath' => file_create_url(outdatedbrowser_get_language_file_path()),
    );
    $page['page_bottom']['#attached']['js'][] = array(
      'data' => array(
        'outdatedbrowser' => $js_settings,
      ),
      'type' => 'setting',
    );
  }
}