You are here

function panelizer_edit_node_layout_page in Panelizer 7

Same name and namespace in other branches
  1. 6 includes/node.inc \panelizer_edit_node_layout_page()

Page to edit basic settings on a panelized node.

1 string reference to 'panelizer_edit_node_layout_page'
panelizer_menu in ./panelizer.module
Implements hook_menu().

File

includes/node.inc, line 292
Contains routines specific to handling nodes that are panelized.

Code

function panelizer_edit_node_layout_page($node) {
  $panelizer = panelizer_load_node_panelizer($node);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  $display = panelizer_load_display($panelizer);
  ctools_include('context');
  $display->context = panelizer_get_contexts($panelizer, $node);
  $output = panels_edit_layout($display, t('Save'), '', 'panelizer_node' . ':' . $node->type);
  if (is_object($output)) {

    // The display was already saved, but if we were given a did, that
    // needs to be saved too.
    if ($panelizer->did != $output->did) {
      ctools_include('export');
      $panelizer->did = $output->did;

      // Ensure we don't try to write again:
      if (isset($panelizer->display)) {
        unset($panelizer->display);
      }
      panelizer_save_node_panelizer($panelizer);
    }
    drupal_goto($_GET['q']);
  }
  return $output;
}