You are here

function ctools_export_ui::delete_page in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/export_ui/ctools_export_ui.class.php \ctools_export_ui::delete_page()

Page callback to delete an exportable item.

File

plugins/export_ui/ctools_export_ui.class.php, line 1154

Class

ctools_export_ui
Base class for export UI.

Code

function delete_page($js, $input, $item) {
  $form_state = array(
    'plugin' => $this->plugin,
    'object' => &$this,
    'ajax' => $js,
    'item' => $item,
    'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete',
    'rerender' => TRUE,
    'no_redirect' => TRUE,
  );
  ctools_include('form');
  $output = ctools_build_form('ctools_export_ui_delete_confirm_form', $form_state);
  if (!empty($form_state['executed'])) {
    ctools_export_crud_delete($this->plugin['schema'], $item);
    $export_key = $this->plugin['export']['key'];
    $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
    drupal_set_message($message);
    drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
  }
  return $output;
}