You are here

function fpa_form_user_admin_permissions_alter in Fast Permissions Administration 7.2

Same name and namespace in other branches
  1. 8.2 fpa.module \fpa_form_user_admin_permissions_alter()
  2. 8.2 fpa.form_alter.inc \fpa_form_user_admin_permissions_alter()
  3. 3.0.x fpa.module \fpa_form_user_admin_permissions_alter()

Implements hook_form_FORM_ID_alter().

File

./fpa.form_alter.inc, line 21
Contains form alter hooks to inject FPA functionality.

Code

function fpa_form_user_admin_permissions_alter(&$form, &$form_state) {

  // Prevent duplication of memory limit warning.
  if (module_exists('filter_perms') && empty($form_state['input'])) {
    $memory_limit = ini_get('memory_limit');
    if (!drupal_check_memory_limit(_fpa_memory_required() . 'b', $memory_limit)) {
      drupal_set_message(t('If you attempt to display all roles and permissions on this page at the same time, you will most likely exceed your PHP memory limit of %memory_limit.', array(
        '%memory_limit' => $memory_limit,
      )), 'warning');
    }
  }
  $form['#theme'] = array(
    'fpa_user_admin_permissions',
  );
  $fpa_module_path = drupal_get_path('module', 'fpa');
  $form['#attached']['library'][] = array(
    'system',
    'jquery.cookie',
  );
  $form['#attached']['css'][] = $fpa_module_path . '/css/fpa.css';
  $form['#attached']['js'][] = $fpa_module_path . '/js/fpa.min.js';
  $form['#attached']['js'][] = array(
    'type' => 'setting',
    'data' => array(
      'fpa' => array(
        'attr' => array(
          'permission' => FPA_ATTR_PERMISSION,
          'module' => FPA_ATTR_MODULE,
          'role' => FPA_ATTR_ROLE,
          'checked' => FPA_ATTR_CHECKED,
          'not_checked' => FPA_ATTR_NOT_CHECKED,
          'system_name' => FPA_ATTR_SYSTEM_NAME,
        ),
      ),
    ),
  );
}