function panels_renderer_legacy::render_regions in Panels 6.3
Render all panes in the attached display into their panel regions, then render those regions.
Return value
array $content An array of rendered panel regions, keyed on the region name.
1 call to panels_renderer_legacy::render_regions()
- panels_renderer_legacy::render in plugins/
display_renderers/ panels_renderer_legacy.class.php - Builds inner content, then hands off to layout-specified theme function for final render step.
File
- plugins/
display_renderers/ panels_renderer_legacy.class.php, line 138
Class
- panels_renderer_legacy
- Legacy render pipeline for a panels display.
Code
function render_regions() {
ctools_include('content');
// First, render all the panes into little boxes. We do this here because
// some panes request to be rendered after other panes (primarily so they
// can do the leftovers of forms).
$panes = $first = $normal = $last = array();
foreach ($this->display->content as $pid => $pane) {
$pane->shown = !empty($pane->shown);
// guarantee this field exists.
// If the user can't see this pane, do not render it.
if (!$pane->shown || !panels_pane_access($pane, $this->display)) {
continue;
}
$content_type = ctools_get_content_type($pane->type);
// If this pane wants to render last, add it to the $last array. We allow
// this because some panes need to be rendered after other panes,
// primarily so they can do things like the leftovers of forms.
if (!empty($content_type['render last'])) {
$last[$pid] = $pane;
}
else {
if (!empty($content_type['render first'])) {
$first[$pid] = $pane;
}
else {
$normal[$pid] = $pane;
}
}
}
foreach ($first + $normal + $last as $pid => $pane) {
$panes[$pid] = $this
->render_pane($pane);
}
// Loop through all panels, put all panes that belong to the current panel
// in an array, then render the panel. Primarily this ensures that the
// panes are in the proper order.
$content = array();
foreach ($this->display->panels as $panel_name => $pids) {
$panel_panes = array();
foreach ($pids as $pid) {
if (!empty($panes[$pid])) {
$panel_panes[$pid] = $panes[$pid];
}
}
$content[$panel_name] = $this
->render_region($panel_name, $panel_panes);
}
// Prevent notices by making sure that all panels at least have an entry:
$panels = panels_get_regions($this->plugins['layout'], $this->display);
foreach ($panels as $id => $panel) {
if (!isset($content[$id])) {
$content[$id] = NULL;
}
}
return $content;
}