You are here

function panels_page_edit_form_submit in Panels 6.2

Same name and namespace in other branches
  1. 5.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 396
panels_page.admin.inc

Code

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

    // The path may have changed - rebuild the menu.
    menu_rebuild();
  }
}