You are here

function panelizer_default_content_page in Panelizer 7

Same name and namespace in other branches
  1. 6 includes/admin.inc \panelizer_default_content_page()
  2. 7.3 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
Implements hook_menu().

File

includes/admin.inc, line 351
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;
  }
  $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']);
  }
  return $output;
}