Form submission handler.
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
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.'));
}