You are here

function textsize_js_alter in Text Size 7

Implement hook_js_alter().

Removes any JavaScript added if we want textsize disabled on the admin theme AND we're currently using the admin theme.

Parameters

$javascript:

File

./textsize.module, line 401
Display a text size changer on the page for a better web accessibility.

Code

function textsize_js_alter(&$javascript) {
  if (textsize_admin_theme_check()) {

    // Unset the JS added with key
    $key = drupal_get_path('module', 'textsize') . '/jquery.textsize.js';
    unset($javascript[$key]);

    // Check any inline JS added with a numeric key
    foreach ($javascript as $key => $js) {
      if (!is_array($javascript[$key]['data']) && strpos($javascript[$key]['data'], 'textsize')) {
        unset($javascript[$key]);
      }
    }
  }
}