You are here

function labjs_suppress in LABjs 6

Same name and namespace in other branches
  1. 7 labjs.module \labjs_suppress()

Disable LABjs for the current page.

This function should be called from within another module's page callback (preferably using module_invoke()) when the taskbar should not be enabled. This is useful for modules that implement popup pages or other special pages where LABjs could break the layout.

Parameters

$set: If FALSE is passed, the suppression state is returned.

3 calls to labjs_suppress()
labjs_advagg_js_pre_alter in ./labjs.module
Implements hook_advagg_js_pre_alter.
labjs_closure in ./labjs.module
Overrides theme_closure().
labjs_preprocess_page in ./labjs.module
Implements hook_preprocess_page().

File

./labjs.module, line 194
LABjs module

Code

function labjs_suppress($set = FALSE) {
  static $suppress;
  if ($set) {
    $suppress = TRUE;
  }
  elseif (!isset($suppress)) {

    // First, check the global enable settings and the maintenance mode,
    // we should disable LABjs in those cases.
    $suppress = !variable_get('labjs_enabled', TRUE) || defined('MAINTENANCE_MODE');

    // Match path if necessary
    if (!$suppress && ($pages = variable_get('labjs_pages_list', ''))) {
      $path = drupal_get_path_alias($_GET['q']);

      // Compare with the internal and path alias (if any).
      $page_match = drupal_match_path($path, $pages);
      if ($path != $_GET['q']) {
        $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
      }
      $suppress = (variable_get('labjs_pages_choice', 0) xor $page_match);
    }
  }
  return $suppress;
}