You are here

function panels_landing_page_finish in Panels 6.3

Same name and namespace in other branches
  1. 7.3 plugins/page_wizards/landing_page.inc \panels_landing_page_finish()

Finish callback for the wizard.

When the wizard is finished, this callback will create the actual page, save it, and redirect the user to view the new work.

1 string reference to 'panels_landing_page_finish'
landing_page.inc in plugins/page_wizards/landing_page.inc

File

plugins/page_wizards/landing_page.inc, line 236

Code

function panels_landing_page_finish(&$form_state) {
  $cache =& $form_state['cache'];

  // Ensure all 'page' features are loaded.
  $page_task = page_manager_get_task('page');

  // Assemble a new page subtask.
  $subtask = page_manager_page_new();
  $subtask->name = $cache->name;
  $subtask->path = $cache->path;
  $subtask->admin_title = $cache->admin_title;
  $subtask->admin_description = $cache->admin_description;
  $subtask->path = $cache->path;
  $subtask->menu = $cache->menu;

  // Create the the panel context variant configured with our display
  $plugin = page_manager_get_task_handler('panel_context');

  // Create a new handler.
  $handler = page_manager_new_task_handler($plugin);
  $handler->conf['title'] = t('Landing page');
  $handler->conf['display'] = $cache->display;
  $handler->conf['pipeline'] = 'ipe';

  // Assemble a new $page cache and assign it our page subtask and task
  // handler.
  $page = new stdClass();
  page_manager_page_new_page_cache($subtask, $page);
  page_manager_handler_add_to_page($page, $handler);

  // Save it
  page_manager_save_page_cache($page);

  // Send us to the new page immediately.
  $form_state['redirect'] = url($cache->path);
}