function PanelizerEntityDefault::page_content in Panelizer 7.2
Same name and namespace in other branches
- 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::page_content()
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 1169 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
function page_content($js, $input, $entity) {
$panelizer = $entity->panelizer;
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(
'panelizer',
$this->entity_type,
$entity_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->display = $form_state['display'];
$entity->panelizer->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']);
}
ctools_set_no_blocks(FALSE);
drupal_set_page_content($output);
$page = element_info('page');
return $page;
}