You are here

public function GroupRoleUIController::overviewFormSubmit in Group 7

Overview form submit callback.

Parameters

array $form: The form array of the overview form.

array $form_state: The overview form state which will be used for submitting.

Overrides EntityDefaultUIController::overviewFormSubmit

File

classes/group_role.ui_controller.inc, line 126
Defines the Entity API UI class for group roles.

Class

GroupRoleUIController
UI class for group roles.

Code

public function overviewFormSubmit($form, &$form_state) {
  if (empty($form_state['values']['weights'])) {
    return;
  }
  foreach ($form_state['values']['weights'] as $name => $weight) {
    $group_role = group_role_load($name);
    if (entity_has_status('group_role', $group_role, ENTITY_FIXED)) {
      continue;
    }
    if ($group_role->weight != $weight) {
      $group_role->weight = $weight;
      $group_role
        ->save();
    }
  }
}