function labjs_suppress in LABjs 7
Same name and namespace in other branches
- 6 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.
4 calls to labjs_suppress()
- labjs_advagg_modify_js_pre_render_alter in ./
labjs.module - Implements hook_advagg_modify_js_pre_render_alter().
- labjs_js_alter in ./
labjs.module - Implements hook_js_alter().
- labjs_page_delivery_callback_alter in ./
labjs.module - Implements hook_page_delivery_callback_alter().
- labjs_preprocess_html_tag in ./
labjs.module - Implements hook_preprocess_html_tag().
File
- ./
labjs.module, line 351 - 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;
}