You are here

function logintoboggan_js_alter in LoginToboggan 7

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

Implement hook_js_alter().

File

./logintoboggan.module, line 407
LoginToboggan module

Code

function logintoboggan_js_alter(&$javascript) {

  // Look for the user permissions js.
  if (isset($javascript['modules/user/user.permissions.js'])) {
    $id = logintoboggan_validating_id();

    // If the pre-auth user isn't the auth user, then swap out core's user
    // permissions js with LT's custom implementation. This is necessary to
    // prevent the pre-auth role's checkboxes from being automatically disabled
    // when the auth user's checkboxes are checked.
    if ($id != DRUPAL_AUTHENTICATED_RID) {
      $javascript['settings']['data'][] = array(
        'LoginToboggan' => array(
          'preAuthID' => $id,
        ),
      );
      $file = drupal_get_path('module', 'logintoboggan') . '/logintoboggan.permissions.js';
      $javascript[$file] = drupal_js_defaults($file);
      $javascript[$file]['weight'] = 999;
    }
  }
}