function lightning_core_form_user_form_alter in Lightning Core 8.5
Same name and namespace in other branches
- 8 lightning_core.module \lightning_core_form_user_form_alter()
- 8.2 lightning_core.module \lightning_core_form_user_form_alter()
- 8.3 lightning_core.module \lightning_core_form_user_form_alter()
- 8.4 lightning_core.module \lightning_core_form_user_form_alter()
Implements hook_form_FORM_ID_alter().
File
- ./
lightning_core.module, line 281 - Contains core functionality for the Lightning distribution.
Code
function lightning_core_form_user_form_alter(array &$form) {
if (isset($form['account']['roles'])) {
$roles = Drupal::entityTypeManager()
->getStorage('user_role')
->loadMultiple();
/** @var \Drupal\user\RoleInterface $role */
foreach ($roles as $id => $role) {
if ($role instanceof EntityDescriptionInterface) {
$form['account']['roles']['#legend'][$id] = $role
->getDescription();
}
}
}
}