You are here

function page_manager_page_delete in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/plugins/tasks/page.inc \page_manager_page_delete()

Remove a page subtask.

1 call to page_manager_page_delete()
page_manager_page_form_delete_submit in page_manager/plugins/tasks/page.admin.inc
Submit handler to delete a view.

File

page_manager/plugins/tasks/page.inc, line 434
Handle the 'page' task, which creates pages with arbitrary tasks and lets handlers decide how they will be rendered.

Code

function page_manager_page_delete($page, $skip_menu_rebuild = FALSE) {
  $task = page_manager_get_task($page->task);
  if ($function = ctools_plugin_get_function($task, 'delete')) {
    $function($page);
  }
  if (!empty($task['uses handlers'])) {
    $handlers = page_manager_load_task_handlers($task, $page->name);
    foreach ($handlers as $handler) {
      page_manager_delete_task_handler($handler);
    }
  }
  db_delete('page_manager_pages')
    ->condition('name', $page->name)
    ->execute();

  // Make sure that the cache is reset so that the menu rebuild does not
  // rebuild this page again.
  ctools_include('export');
  ctools_export_load_object_reset('page_manager_pages');

  // Allow menu rebuild to be skipped when calling code is deleting multiple
  // pages.
  if (!$skip_menu_rebuild) {
    menu_rebuild();
  }
}