function PanelizerEntityDefault::page_layout in Panelizer 7.3
Same name and namespace in other branches
- 7.2 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::page_layout()
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 2515 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
function page_layout($js, $input, $entity, $view_mode, $step = NULL, $layout = NULL) {
$panelizer = $entity->panelizer[$view_mode];
if (empty($panelizer)) {
return MENU_NOT_FOUND;
}
list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
$display = $panelizer->display;
$display->context = $this
->get_contexts($panelizer, $entity);
$path = $this
->entity_base_url($entity, $view_mode);
$form_state = array(
'entity' => $entity,
'revision info' => $this
->entity_allows_revisions($entity),
'display' => $display,
'wizard path' => $path . '/layout/%step',
'allowed_layouts' => panelizer_get_allowed_layouts_option($this->entity_type, $bundle),
);
ctools_include('common', 'panelizer');
$output = panelizer_change_layout_wizard($form_state, $step, $layout);
if (!empty($form_state['complete'])) {
$entity->panelizer[$view_mode]->display = $form_state['display'];
$entity->panelizer[$view_mode]->display_is_modified = TRUE;
$this
->entity_save($entity);
drupal_set_message(t('The layout has been changed.'));
drupal_goto($path . '/content');
}
return $this
->wrap_entity_panelizer_pages($entity, $view_mode, $output);
}