You are here

function panelizer_default_content_page in Panelizer 6

Same name and namespace in other branches
  1. 7.3 includes/admin.inc \panelizer_default_content_page()
  2. 7 includes/admin.inc \panelizer_default_content_page()
  3. 7.2 includes/admin.inc \panelizer_default_content_page()

Pass through to the panels content editor.

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

File

includes/admin.inc, line 376
Contains administrative forms and settings.

Code

function panelizer_default_content_page($type, $key, $name) {
  $panelizer = panelizer_load_default($type, $key, $name);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }

  // Drupal kills our breadcrumb. Put it back.
  ctools_include('menu');
  ctools_menu_set_trail_parent('admin/settings/panelizer');
  $cache = panels_edit_cache_get('panelizer:default:' . $type . ':' . $key . ':' . $name);
  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);
      }
      ctools_export_crud_save('panelizer_defaults', $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);
}