You are here

function lightning_core_form_user_form_alter in Lightning Core 8.4

Same name and namespace in other branches
  1. 8.5 lightning_core.module \lightning_core_form_user_form_alter()
  2. 8 lightning_core.module \lightning_core_form_user_form_alter()
  3. 8.2 lightning_core.module \lightning_core_form_user_form_alter()
  4. 8.3 lightning_core.module \lightning_core_form_user_form_alter()

Implements hook_form_FORM_ID_alter().

File

./lightning_core.module, line 201
Contains core functionality for the Lightning distribution.

Code

function lightning_core_form_user_form_alter(array &$form) {
  if (isset($form['account']['roles'])) {

    /** @var \Drupal\user\RoleInterface $role */
    foreach (Role::loadMultiple() as $id => $role) {
      if ($role instanceof EntityDescriptionInterface) {
        $form['account']['roles']['#legend'][$id] = $role
          ->getDescription();
      }
    }
  }
}