You are here

function logintoboggan_js_alter in LoginToboggan 8

Same name and namespace in other branches
  1. 7 logintoboggan.module \logintoboggan_js_alter()

Implements hook_js_alter().

File

./logintoboggan.module, line 238
LoginToboggan module.

Code

function logintoboggan_js_alter(&$javascript) {

  // Look for the user permissions js.
  if (isset($javascript['modules/user/user.permissions.js'])) {
    $trusted_role = LogintobogganUtility::trustedRole();

    // If the trusted role isn't the auth user, then swap out core's user
    // permissions js with LT's custom implementation. This is necessary to
    // prevent the trusted role's checkboxes from being automatically disabled
    // when the auth user's checkboxes are checked.
    $auth_role = User::AUTHENTICATED_ROLE;
    if ($trusted_role != $auth_role) {
      $javascript['modules/user/user.permissions.js']['data'] = drupal_get_path('module', 'logintoboggan') . '/js/logintoboggan.permissions.js';
    }
  }
}