public function PanelsPaneController::view in Fieldable Panels Panes (FPP) 7
Display a given FPP object.
Parameters
object $entity: The FPP object to be displayed.
string $view_mode: The view mode to use; defaults to 'full', i.e. the normal "full content" display.
string $langcode: The language code to use for this; defaults to the current content language code.
Return value
array A render array.
File
- includes/
PanelsPaneController.class.php, line 270 - Contains the controller class for the Fieldable Panel Pane entity.
Class
- PanelsPaneController
- Entity controller class.
Code
public function view($entity, $view_mode = 'full', $langcode = NULL) {
if (!isset($langcode)) {
$langcode = $GLOBALS['language_content']->language;
}
// Populate $entity->content with a render() array.
$this
->buildContent($entity, $view_mode, $langcode);
$build = $entity->content;
// We don't need duplicate rendering info in $entity->content.
unset($entity->content);
$build += array(
'#theme' => 'fieldable_panels_pane',
'#fieldable_panels_pane' => $entity,
'#element' => $entity,
'#view_mode' => $view_mode,
'#language' => $langcode,
);
// Add contextual links for this fieldable panel pane, except when the pane
// is already being displayed on its own page. Modules may alter this
// behavior (for example, to restrict contextual links to certain view
// modes) by implementing hook_fieldable_panels_pane_view_alter().
if (!empty($entity->fpid) && !($view_mode == 'full' && fieldable_panels_pane_is_page($entity))) {
// Allow the contextual links to be controlled from the settings page.
if (!variable_get('fpp_hide_contextual_links', FALSE)) {
$build['#contextual_links']['fieldable_panels_panes'] = array(
'admin/structure/fieldable-panels-panes/view',
array(
$entity->fpid,
),
);
}
}
// Allow modules to modify the structured pane.
$type = 'fieldable_panels_pane';
drupal_alter(array(
'fieldable_panels_pane_view',
'entity_view',
), $build, $type);
return $build;
}