public function RoleListController::submitForm

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: An associative array containing the current state of the form.

Overrides FormInterface::submitForm

File

drupal/core/modules/user/lib/Drupal/user/RoleListController.php, line 124
Contains \Drupal\user\RoleListController.

Class

RoleListController
Provides a listing of user roles.

Namespace

Drupal\user

Code

public function submitForm(array &$form, array &$form_state) {
  $values = $form_state['values']['entities'];
  $entities = entity_load_multiple($this->entityType, array_keys($values));
  foreach ($values as $id => $value) {
    if (isset($entities[$id]) && $value['weight'] != $entities[$id]
      ->get('weight')) {

      // Update changed weight.
      $entities[$id]
        ->set('weight', $value['weight']);
      $entities[$id]
        ->save();
    }
  }
  drupal_set_message(t('The role settings have been updated.'));
}