You are here

function panels_page_edit_form_submit in Panels 5.2

Same name and namespace in other branches
  1. 6.2 panels_page/panels_page.admin.inc \panels_page_edit_form_submit()

Process submission of the panel page edit form

File

panels_page/panels_page.admin.inc, line 369
panels_page.admin.inc

Code

function panels_page_edit_form_submit($form_id, $form_values) {
  $panel_page = $form_values['panel_page'];
  $panel_page->title = $form_values['title'];
  $panel_page->name = preg_replace("/[\\W]+/", '', $form_values['name']);
  $panel_page->css_id = $form_values['css_id'];
  $panel_page->path = $form_values['path'];
  if ($panel_page->pid == 'new') {
    isset($_SESSION['pp_import']) ? panels_page_save_import($panel_page) : panels_page_save($panel_page);
    unset($_SESSION['pp_import']);
    drupal_set_message(t('Your new panel page %title has been saved.', array(
      '%title' => $panel_page->title,
    )));
    $GLOBALS['form_values']['pid'] = $panel_page->pid;
    $layout = panels_get_layout($panel_page->display->layout);
    if (!empty($layout['settings form'])) {
      return "admin/panels/panel-page/{$panel_page->name}/edit/settings/next";
    }
    return "admin/panels/panel-page/{$panel_page->name}/edit/advanced/next";
  }
  else {
    drupal_set_message(t('Your changes have been saved.'));
    panels_page_save($panel_page);
  }
}