diff --git a/core/modules/user/lib/Drupal/user/RoleListController.php b/core/modules/user/lib/Drupal/user/RoleListController.php index 80f3842..3e96340 100644 --- a/core/modules/user/lib/Drupal/user/RoleListController.php +++ b/core/modules/user/lib/Drupal/user/RoleListController.php @@ -8,11 +8,19 @@ use Drupal\Core\Config\Entity\ConfigEntityListController; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Form\FormInterface; /** * Provides a listing of contact categories. */ -class RoleListController extends ConfigEntityListController { +class RoleListController extends ConfigEntityListController implements FormInterface { + + /** + * Implements \Drupal\Core\Form\FormInterface::getFormID(). + */ + public function getFormID() { + return 'user_admin_roles_form'; + } /** * Overrides \Drupal\Core\Entity\EntityListController::buildHeader(). @@ -31,19 +39,15 @@ public function buildHeader() { public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); - $operations['edit']['title'] = t('edit role'); $operations['permissions'] = array( - 'title' => t('edit permissions'), + 'title' => t('Edit permissions'), 'href' => 'admin/people/permissions/' . $entity->id(), - 'weight' => 20, + 'weight' => 5, ); // Build-in roles could not be deleted. if (in_array($entity->id(), array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { unset($operations['delete']); } - else { - $operations['delete']['title'] = t('delete role'); - } return $operations; } @@ -78,15 +82,13 @@ public function buildRow(EntityInterface $entity) { * Overrides \Drupal\Core\Entity\EntityListController::render(). */ public function render() { - $form_state = array(); - $form_state['build_info']['args'] = array(); - $form_state['build_info']['callback'] = array($this, 'form'); - - return drupal_build_form($this->entityType . '_list_form', $form_state); + return drupal_get_form($this); } /** - * Creates a tabledrag form for manipulating role weights. + * Implements \Drupal\Core\Form\FormInterface::buildForm(). + * + * Form constructor for manipulating role weights. * * @param array $form * An associative array containing the structure of the form. @@ -96,7 +98,7 @@ public function render() { * @return array * The array containing the complete form. */ - public function form($form, &$form_state) { + public function buildForm(array $form, array &$form_state) { $form['entities'] = array( '#type' => 'table', '#header' => $this->buildHeader(), @@ -114,7 +116,6 @@ public function form($form, &$form_state) { $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save order'), - '#submit' => array(array($this, 'submit')), '#button_type' => 'primary', ); @@ -122,14 +123,23 @@ public function form($form, &$form_state) { } /** - * Submit handler for the overview form. + * Implements \Drupal\Core\Form\FormInterface::validateForm(). + */ + public function validateForm(array &$form, array &$form_state) { + // No validation. + } + + /** + * Implements \Drupal\Core\Form\FormInterface::submitForm(). + * + * Form submission handler for the roles overview form. * * @param array $form * An associative array containing the structure of the form. * @param array $form_state * A reference to a keyed array containing the current state of the form. */ - public function submit($form, &$form_state) { + public function submitForm(array &$form, array &$form_state) { $values = $form_state['values']['entities']; $entities = entity_load_multiple($this->entityType, array_keys($values));