You are here

function panelizer_edit_node_content_page in Panelizer 6

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

Page to edit basic settings on a panelized node.

1 string reference to 'panelizer_edit_node_content_page'
panelizer_menu in ./panelizer.module
Implementation of hook_menu().

File

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

Code

function panelizer_edit_node_content_page($node) {
  $panelizer = panelizer_load_node_panelizer($node);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  _panelizer_check_admin_theme();
  $cache = panels_edit_cache_get('panelizer:node:' . $node->nid);
  ctools_include('plugins', 'panels');
  ctools_include('display-edit', 'panels');
  ctools_include('context');
  $renderer = panels_get_renderer_handler('editor', $cache->display);
  $renderer->cache = $cache;
  $output = $renderer
    ->edit();
  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->new = FALSE;
      panelizer_save_node_panelizer($panelizer);
    }
    panels_edit_cache_clear($cache);
    drupal_goto($_GET['q']);
  }

  // Print this with theme('page') so that blocks are disabled while editing a display.
  // This is important because negative margins in common block layouts (i.e, Garland)
  // messes up the drag & drop.
  print theme('page', $output, FALSE);
}