You are here

function page_manager_page_save_subtask in Chaos Tool Suite (ctools) 7

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

Call back from the administrative system to save a page.

We get the $subtask as created by page_manager_page_build_subtask.

1 string reference to 'page_manager_page_save_subtask'
page_manager_page_page_manager_tasks in page_manager/plugins/tasks/page.inc
Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for more information.

File

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

Code

function page_manager_page_save_subtask($subtask) {
  $page =& $subtask['subtask'];

  // Ensure $page->arguments contains only real arguments:
  $arguments = page_manager_page_get_named_arguments($page->path);
  $args = array();
  foreach ($arguments as $keyword => $position) {
    if (isset($page->arguments[$keyword])) {
      $args[$keyword] = $page->arguments[$keyword];
    }
    else {
      $args[$keyword] = array(
        'id' => '',
        'identifier' => '',
        'argument' => '',
        'settings' => array(),
      );
    }
  }
  page_manager_page_recalculate_arguments($page);

  // Create a real object from the cache.
  page_manager_page_save($page);

  // Check to see if we should make this the site frontpage.
  if (!empty($page->make_frontpage)) {
    $path = array();
    foreach (explode('/', $page->path) as $bit) {
      if ($bit[0] != '!') {
        $path[] = $bit;
      }
    }
    $path = implode('/', $path);
    $front = variable_get('site_frontpage', 'node');
    if ($path != $front) {
      variable_set('site_frontpage', $path);
    }
  }
}