You are here

function js_injector_page_build in JS injector 7.2

Same name and namespace in other branches
  1. 8 js_injector.module \js_injector_page_build()

Implements hook_page_build().

File

./js_injector.module, line 170
js_injector.module

Code

function js_injector_page_build(&$page) {
  global $theme;
  $rules = _js_inject_active_rules();
  if (!is_array($rules) || empty($rules)) {
    return;
  }
  foreach ($rules as $rule) {
    if (!isset($rule->noscript_regions) || !isset($rule->noscript) || empty($rule->noscript_regions) || empty($rule->noscript)) {
      continue;
    }
    if (!isset($rule->noscript_regions[$theme])) {
      continue;
    }
    $page[$rule->noscript_regions[$theme]]['noscript'][$rule->name] = array(
      '#theme' => 'html_tag',
      '#tag' => 'noscript',
      '#value' => $rule->noscript,
    );
  }
}