You are here

function purge_item_action_form_submit in Purge 7.2

Form submition for item ation form.

1 string reference to 'purge_item_action_form_submit'
purge_item_action_form in includes/purge_ui.inc
Form for simple yes/no operations on items.

File

includes/purge_ui.inc, line 674
Provides administrative interface for the Purge module.

Code

function purge_item_action_form_submit($form, &$form_state) {

  // load the bundle and the item.
  $bundle = new PurgePurgerBundleUI();
  $item_type = $form_state['values']['item_type'];
  $item_name = $form_state['values']['item_name'];
  $action = $form_state['values']['action'];
  $item = $bundle->{$item_type}[$item_name];

  // Perform the action.
  if ($action == 'delete') {

    // Delete the item from the bundle.
    $item_name_full = $item->name;
    unset($bundle->{$item_type}[$item_name]);

    // Save the bundle.
    $bundle
      ->save();

    // Display a status message.
    drupal_set_message(t('@item_name is now deleted.', array(
      '@item_name' => drupal_ucfirst($item_name_full),
    )));
  }
  $form_state['redirect'] = 'admin/config/system/purge';
  return $form;
}