function PanelizerEntityDefault::page_content in Panelizer 7.3
Same name and namespace in other branches
- 7.2 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::page_content()
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 2549 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
function page_content($js, $input, $entity, $view_mode) {
$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);
$form_state = array(
'entity' => $entity,
'revision info' => $this
->entity_allows_revisions($entity),
'display cache' => panels_edit_cache_get(implode(':', array_filter(array(
'panelizer',
$this->entity_type,
$entity_id,
$view_mode,
$revision_id,
)))),
'no_redirect' => TRUE,
);
ctools_include('common', 'panelizer');
$output = drupal_build_form('panelizer_edit_content_form', $form_state);
if (!empty($form_state['executed'])) {
if (!empty($form_state['clicked_button']['#save-display'])) {
drupal_set_message(t('The settings have been updated.'));
$entity->panelizer[$view_mode]->display = $form_state['display'];
$entity->panelizer[$view_mode]->display_is_modified = TRUE;
$this
->entity_save($entity);
}
else {
drupal_set_message(t('Changes have been discarded.'));
}
panels_edit_cache_clear($form_state['display cache']);
drupal_goto($_GET['q']);
}
$output = $this
->wrap_entity_panelizer_pages($entity, $view_mode, $output);
ctools_set_no_blocks(FALSE);
drupal_set_page_content($output);
$page = element_info('page');
return $page;
}