You are here

function panels_page_add_page in Panels 5.2

Handle the add panel-page page.

1 string reference to 'panels_page_add_page'
panels_page_menu in panels_page/panels_page.module
Implementation of hook_menu().

File

panels_page/panels_page.admin.inc, line 178
panels_page.admin.inc

Code

function panels_page_add_page($layout = NULL) {
  $layouts = panels_get_layouts();

  // If the layout given is invalid, unset it.
  if (is_array($layout) && isset($layouts[$layout])) {
    drupal_set_message(t('The chosen layout %layout is invalid. Please select a new one.', array(
      '%layout' => $layout,
    )), 'warning');
    unset($layout);
  }

  // If no page layout is given, choose one first.
  if ($layout === NULL) {
    foreach ($layouts as $id => $layout) {
      $output .= panels_print_layout_link($id, $layout, $_GET['q'] . '/' . $id);
    }
    return $output;
  }
  $panel_page = new stdClass();
  $panel_page->primary = panels_new_display();
  $panel_page->display =& $panel_page->primary;
  $panel_page->display->layout = $layout;
  $panel_page->pid = 'new';
  $panel_page->did = 'new';
  drupal_set_title(t('Add panel page'));
  return drupal_get_form('panels_page_edit_form', panels_page_sanitize($panel_page));
}