You are here

function panelizer_default_layout_page in Panelizer 7.2

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

Pass through to the panels layout editor.

2 string references to 'panelizer_default_layout_page'
PanelizerEntityDefault::add_admin_links in plugins/entity/PanelizerEntityDefault.class.php
Helper function to add administrative menu items into an entity's already existing structure.
panelizer_admin_hook_menu in includes/admin.inc
Delegated hook_menu for admin

File

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

Code

function panelizer_default_layout_page($handler, $bundle, $name, $step = NULL, $layout = NULL) {
  if (is_string($handler)) {
    $handler = panelizer_entity_plugin_get_handler($handler);
  }
  $panelizer = $handler
    ->get_default_panelizer_object($bundle, $name);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  $display = $panelizer->display;
  $display->context = $handler
    ->get_contexts($panelizer);
  if ($name == 'default' && $handler
    ->has_default_panel($bundle)) {
    $path = 'admin/config/content/panelizer/' . $handler->entity_type . '/' . $bundle;
  }
  else {
    $path = 'admin/config/content/panelizer/' . $handler->entity_type . '/' . $bundle . '/list/' . $name;
  }
  $form_state = array(
    'display' => $display,
    'wizard path' => $path . '/layout/%step',
    'allowed_layouts' => 'panelizer_' . $handler->entity_type . ':' . $bundle,
  );
  ctools_include('common', 'panelizer');
  $output = panelizer_change_layout_wizard($form_state, $step, $layout);
  if (!empty($form_state['complete'])) {
    $panelizer->display = $form_state['display'];
    ctools_export_crud_save('panelizer_defaults', $panelizer);
    drupal_set_message(t('The layout has been changed.'));
    drupal_goto($path . '/content');
  }
  return $output;
}