You are here

function js_module_implements_alter in JS Callback Handler 7.2

Implements hook_module_implements_alter().

File

./js.module, line 280
JavaScript callback handler module.

Code

function js_module_implements_alter(&$implementations, $hook) {
  global $_js;

  // We need to make sure hook implementation cache is never written while
  // processing a JS request.
  // Since most callbacks act at a bootstrap level lower than full, that is
  // without loading all modules.
  if (!empty($_js['module']) && !empty($_js['callback'])) {
    $global_implementations =& drupal_static('module_implements');

    // Remove the flag to write this cache.
    unset($global_implementations['#write_cache']);
  }

  // Remove the JS module from the services module hook.
  // @see https://www.drupal.org/project/js/issues/3075281
  if ($hook === 'server_info' && !empty($implementations['js'])) {
    unset($implementations['js']);
  }
}