You are here

function skinr_context_ui_admin_groups_submit in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_context/skinr_context_ui.admin.inc \skinr_context_ui_admin_groups_submit()

Form submission handler for skinr_context_ui_admin_list().

Execute the chosen 'Update option' on the selected skin configuration groups.

1 string reference to 'skinr_context_ui_admin_groups_submit'
skinr_context_ui_admin_list_subform in skinr_context/skinr_context_ui.admin.inc
Overrides skinr_ui_admin_skins().

File

skinr_context/skinr_context_ui.admin.inc, line 364
Admin page callbacks for the Skinr Context UI module.

Code

function skinr_context_ui_admin_groups_submit($form, &$form_state) {
  $operations = module_invoke_all('skinr_context_ui_operations');
  $operation = $operations[$form_state['values']['operation']];

  // Filter out unchecked nodes
  $groups = array_filter($form_state['values']['groups']);
  if ($function = $operation['callback']) {

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $groups,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $groups,
      );
    }
    call_user_func_array($function, $args);
    cache_clear_all();
  }
  else {

    // We need to rebuild the form to go to a second step. For example, to
    // show the confirmation form for the deletion of nodes.
    $form_state['rebuild'] = TRUE;
  }
}