You are here

function panelizer_defaults_ui::delete_page in Panelizer 7.3

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

Page callback to delete an exportable item.

Overrides ctools_export_ui::delete_page

File

plugins/export_ui/panelizer_defaults_ui.class.php, line 129
Contains the administrative UI for selectable panelizer defaults.

Class

panelizer_defaults_ui
@file Contains the administrative UI for selectable panelizer defaults.

Code

function delete_page($js, $input, $item) {
  $clone = clone $item;

  // Change the name into the title so the form shows the right value.
  // @todo file a bug against CTools to use admin title if available.
  $clone->name = $clone->title;
  $form_state = array(
    'plugin' => $this->plugin,
    'object' => &$this,
    'ajax' => $js,
    'item' => $clone,
    'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete',
    'rerender' => TRUE,
    'no_redirect' => TRUE,
  );
  $output = drupal_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'];
    drupal_set_message(t($this->plugin['strings']['confirmation'][$form_state['op']]['success'], array(
      '%title' => $item->title,
    )));
    drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
  }
  return $output;
}