Issue #987978 by vsujeetkumar, paulocs, ankithashetty, Gauravmahlawat,...
Issue #987978 by vsujeetkumar, paulocs, ankithashetty, Gauravmahlawat, yogen.prasad, Suresh Prabhu Parkala, vikashsoni, dww, AaronMcHale, naught101: Move "administrator role" setting to new Role Settings form
@@ -101,34 +101,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#required'=>TRUE,
];
// Administrative role option.
$form['admin_role']=[
'#type'=>'details',
'#title'=>$this->t('Administrator role'),
'#open'=>TRUE,
];
// Do not allow users to set the anonymous or authenticated user roles as the
// administrator role.
$roles=user_role_names(TRUE);
unset($roles[RoleInterface::AUTHENTICATED_ID]);
$admin_roles=$this->roleStorage->getQuery()
->condition('is_admin',TRUE)
->execute();
$default_value=reset($admin_roles);
$form['admin_role']['user_admin_role']=[
'#type'=>'select',
'#title'=>$this->t('Administrator role'),
'#empty_value'=>'',
'#default_value'=>$default_value,
'#options'=>$roles,
'#description'=>$this->t('This role will be automatically assigned new permissions whenever a module is enabled. Changing this setting will not affect existing permissions.'),
// Don't allow to select a single admin role in case multiple roles got
// marked as admin role already.
'#access'=>count($admin_roles)<=1,
];
// @todo Remove this check once language settings are generalized.
// Do not allow users to set the anonymous or authenticated user roles as
// the administrator role.
$roles=user_role_names(TRUE);
unset($roles[RoleInterface::AUTHENTICATED_ID]);
$admin_roles=$this->roleStorage->getQuery()
->condition('is_admin',TRUE)
->execute();
$default_value=reset($admin_roles);
$form['admin_role']['user_admin_role']=[
'#type'=>'select',
'#title'=>$this->t('Administrator role'),
'#empty_value'=>'',
'#default_value'=>$default_value,
'#options'=>$roles,
'#description'=>$this->t('This role will be automatically assigned new permissions whenever a module is enabled. Changing this setting will not affect existing permissions.'),
// Don't allow to select a single admin role in case multiple roles got