diff --git a/core/modules/user/lib/Drupal/user/RoleFormController.php b/core/modules/user/lib/Drupal/user/RoleFormController.php index 70fa858..145cfec 100644 --- a/core/modules/user/lib/Drupal/user/RoleFormController.php +++ b/core/modules/user/lib/Drupal/user/RoleFormController.php @@ -39,7 +39,6 @@ public function form(array $form, array &$form_state, EntityInterface $entity) { '#maxlength' => 64, '#machine_name' => array( 'exists' => 'user_role_load', - 'source' => array('label'), ), ); $form['weight'] = array( @@ -56,10 +55,7 @@ public function form(array $form, array &$form_state, EntityInterface $entity) { protected function actions(array $form, array &$form_state) { $entity = $this->getEntity($form_state); $actions = parent::actions($form, $form_state); - // Adjust actions. - $actions['submit']['#value'] = !$entity->isNew() ? t('Save role') : t('Add role'); - $actions['delete']['#value'] = t('Delete role'); - // Disable delete of new and build-in roles. + // Disable delete of new and built-in roles. $actions['delete']['#access'] = !$entity->isNew() && !in_array($entity->id(), array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID)); return $actions; } @@ -74,8 +70,8 @@ public function save(array $form, array &$form_state) { $entity->set('label', trim($entity->label())); $uri = $entity->uri(); if ($entity->save() == SAVED_UPDATED) { - drupal_set_message(t('Role %label has been renamed.', array('%label' => $entity->label()))); - watchdog('user', 'Role %label has been renamed.', array('%label' => $entity->label()), WATCHDOG_NOTICE, l(t('Edit'), $uri['path'])); + drupal_set_message(t('Role %label has been updated.', array('%label' => $entity->label()))); + watchdog('user', 'Role %label has been updated.', array('%label' => $entity->label()), WATCHDOG_NOTICE, l(t('Edit'), $uri['path'])); } else { drupal_set_message(t('Role %label has been added.', array('%label' => $entity->label()))); diff --git a/core/modules/user/lib/Drupal/user/RoleListController.php b/core/modules/user/lib/Drupal/user/RoleListController.php index cd0fed5..086ab8f 100644 --- a/core/modules/user/lib/Drupal/user/RoleListController.php +++ b/core/modules/user/lib/Drupal/user/RoleListController.php @@ -43,11 +43,12 @@ public function getOperations(EntityInterface $entity) { $operations['permissions'] = array( 'title' => t('Edit permissions'), 'href' => 'admin/people/permissions/' . $entity->id(), - 'weight' => 5, + 'weight' => 20, ); - // Build-in roles could not be deleted. + // Built-in roles could not be deleted or disabled. if (in_array($entity->id(), array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { unset($operations['delete']); + unset($operations['disable']); } return $operations; } diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php index 412c889..7a5caa3 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php @@ -52,7 +52,7 @@ function testRoleAdministration() { $role_name = '456'; $edit = array('label' => $role_name); $this->drupalPost("admin/people/roles/manage/{$role->id()}", $edit, t('Save role')); - $this->assertRaw(t('Role %label has been renamed.', array('%label' => $role_name))); + $this->assertRaw(t('Role %label has been updated.', array('%label' => $role_name))); $new_role = entity_load('user_role', $old_name); $this->assertEqual($new_role->label(), $role_name, 'The role name has been successfully changed.'); diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 01c9f17..c9820d7 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -980,7 +980,6 @@ function user_menu() { $items['admin/people/roles/manage/%user_role/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/people/roles/manage/%user_role/delete'] = array( 'title' => 'Delete role', @@ -988,8 +987,9 @@ function user_menu() { 'page arguments' => array('user_admin_role_delete_confirm', 4), 'access callback' => 'user_role_delete_access', 'access arguments' => array(4), - 'type' => MENU_LOCAL_TASK, 'weight' => 10, + 'type' => MENU_LOCAL_TASK, + 'context' => MENU_CONTEXT_INLINE, 'file' => 'user.admin.inc', );