function devel_form_user_admin_permissions_alter

Same name in other branches
  1. 7.x-1.x devel.module \devel_form_user_admin_permissions_alter()
  2. 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 717

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;
            }
        }
    }
}