You are here

function devel_form_user_admin_permissions_alter in Devel 8.3

Same name and namespace in other branches
  1. 8 devel.module \devel_form_user_admin_permissions_alter()
  2. 8.2 devel.module \devel_form_user_admin_permissions_alter()
  3. 7 devel.module \devel_form_user_admin_permissions_alter()
  4. 4.x devel.module \devel_form_user_admin_permissions_alter()

Implements hook_form_FORM_ID_alter().

Adds mouse-over hints on the Permissions page to display language-independent machine names and module base names.

See also

\Drupal\user\Form\UserPermissionsForm::buildForm()

File

./devel.module, line 701
This module holds functions useful for Drupal development.

Code

function devel_form_user_admin_permissions_alter(&$form, FormStateInterface $form_state) {
  if (\Drupal::currentUser()
    ->hasPermission('access devel information') && \Drupal::config('devel.settings')
    ->get('raw_names')) {
    foreach (Element::children($form['permissions']) as $key) {
      if (isset($form['permissions'][$key][0])) {
        $form['permissions'][$key][0]['#wrapper_attributes']['title'] = $key;
      }
      elseif (isset($form['permissions'][$key]['description'])) {
        $form['permissions'][$key]['description']['#wrapper_attributes']['title'] = $key;
      }
    }
  }
}