summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-08-07 21:12:12 (GMT)
committerAlex Pott2014-08-07 21:12:12 (GMT)
commit945ed2017717ad70058ec13faa86f8cc807d98d7 (patch)
tree7e052269cf88b5579405c1b2848c225dca2ffac5
parent18ddb0044c8b935a7a2037de0189cc85435c3d2b (diff)
Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated users' role.
-rw-r--r--core/modules/user/src/AccountForm.php19
1 files changed, 6 insertions, 13 deletions
diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php
index c9451a6..5a8fe2e 100644
--- a/core/modules/user/src/AccountForm.php
+++ b/core/modules/user/src/AccountForm.php
@@ -195,18 +195,6 @@ abstract class AccountForm extends ContentEntityForm {
);
$roles = array_map(array('\Drupal\Component\Utility\String', 'checkPlain'), user_role_names(TRUE));
- // The disabled checkbox subelement for the 'authenticated user' role
- // must be generated separately and added to the checkboxes element,
- // because of a limitation in Form API not supporting a single disabled
- // checkbox within a set of checkboxes.
- // @todo This should be solved more elegantly. See issue #119038.
- $checkbox_authenticated = array(
- '#type' => 'checkbox',
- '#title' => $roles[DRUPAL_AUTHENTICATED_RID],
- '#default_value' => TRUE,
- '#disabled' => TRUE,
- );
- unset($roles[DRUPAL_AUTHENTICATED_RID]);
$form['account']['roles'] = array(
'#type' => 'checkboxes',
@@ -214,7 +202,12 @@ abstract class AccountForm extends ContentEntityForm {
'#default_value' => (!$register ? $account->getRoles() : array()),
'#options' => $roles,
'#access' => $roles && $user->hasPermission('administer permissions'),
- DRUPAL_AUTHENTICATED_RID => $checkbox_authenticated,
+ );
+
+ // Special handling for the inevitable "Authenticated user" role.
+ $form['account']['roles'][DRUPAL_AUTHENTICATED_RID] = array(
+ '#default_value' => TRUE,
+ '#disabled' => TRUE,
);
$form['account']['notify'] = array(