You are here

public function CacheflushUIController::overviewFormOperationSubmit in CacheFlush 7.3

Process CacheflushUIController::overviewForm form submissions.

Executes the chosen 'Update Option' on the selected presets.

1 call to CacheflushUIController::overviewFormOperationSubmit()
CacheflushUIController::overviewFormSubmit in modules/cacheflush_ui/includes/cacheflush_ui.class.inc
Overrides EntityDefaultUIController::overviewFormSubmit().

File

modules/cacheflush_ui/includes/cacheflush_ui.class.inc, line 172
Contains the CacheflushUIController class.

Class

CacheflushUIController
Custom controller for the administrator UI.

Code

public function overviewFormOperationSubmit($form, &$form_state) {
  $operations = module_invoke_all('cacheflush_ui_operations');
  $operation = $operations[$form_state['values']['operation']];

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

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $presets,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $presets,
      );
    }
    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 presets.
    $form_state['rebuild'] = TRUE;
  }
  node_types_rebuild();
  menu_rebuild();
}