You are here

function restrict_ip_js_alter in Restrict IP 7

Same name and namespace in other branches
  1. 8.2 restrict_ip.module \restrict_ip_js_alter()
  2. 8 restrict_ip.module \restrict_ip_js_alter()
  3. 7.2 restrict_ip.module \restrict_ip_js_alter()
  4. 3.x restrict_ip.module \restrict_ip_js_alter()

Implementation of hook_js_alter()

This function removes all javascript from the page with the exception of jquery.js and the javascript file provided with the module

File

./restrict_ip.module, line 322

Code

function restrict_ip_js_alter(&$javascript) {
  if (restrict_ip_value()) {
    $restrict_ip_js_path = drupal_get_path('module', 'restrict_ip') . '/js/restrict_ip.js';
    foreach (array_keys($javascript) as $key) {
      if ($key != $restrict_ip_js_path && $key != 'misc/jquery.js') {
        unset($javascript[$key]);
      }
    }
  }
}