class esi_panels_renderer_ipe in ESI: Edge Side Includes 7.3
Extend the panels_renderer_ipe class.
Hierarchy
- class \panels_renderer_standard
- class \panels_renderer_editor
- class \panels_renderer_ipe
- class \esi_panels_renderer_ipe
- class \panels_renderer_ipe
- class \panels_renderer_editor
Expanded class hierarchy of esi_panels_renderer_ipe
1 string reference to 'esi_panels_renderer_ipe'
- esi_ipe.inc in modules/
esi_panels/ plugins/ display_renderers/ esi_ipe.inc
File
- modules/
esi_panels/ plugins/ display_renderers/ esi_panels_renderer_ipe.class.php, line 10 - Replacement for IPE editor.
View source
class esi_panels_renderer_ipe extends panels_renderer_ipe {
/**
* Prepare the list of panes to be rendered, accounting for visibility/access
* settings and rendering order.
*
* This method represents the standard approach for determining the list of
* panes to be rendered that is compatible with all parts of the Panels
* architecture. It first applies visibility checks, then sorts panes into
* their proper rendering order, and returns the result as an array.
*
* Inheriting classes should override this method if that renderer needs to
* regularly make additions to the set of panes that will be rendered.
*
* @param array $panes
* An associative array of pane data (stdClass objects), keyed on pane id.
*
* @return array
* An associative array of panes to be rendered, keyed on pane id and sorted
* into proper rendering order.
*/
function prepare_panes($panes) {
// Override parent::prepare_panes, so that any access-controls are not
// applied to ESI panes. This ensures that panes are al
ctools_include('content');
// Use local variables as writing to them is very slightly faster
$first = $normal = $last = array();
// Prepare the list of panes to be rendered
foreach ($panes as $pid => $pane) {
if (empty($this->admin)) {
// @TODO remove in 7.x and ensure the upgrade path weeds out any stragglers; it's been long enough
$pane->shown = !empty($pane->shown);
// guarantee this field exists.
// If this pane is not displayed, skip out and do the next one.
// Do not handle user-access controls here for ESI panes (handle in the
// ESI rendering).
if (!$this
->pane_should_be_rendered($pane)) {
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;
}
}
}
$this->prepared['panes'] = $first + $normal + $last;
return $this->prepared['panes'];
}
/**
* Test if a pane (or ESI tag) should be rendered. Normal panes are checked
* for visibility and access-control rules. Panes rendered by ESI are just
* checked for visibility.
*/
function pane_should_be_rendered($pane) {
if (!$pane->shown) {
return FALSE;
}
elseif (!empty($pane->cache) && $pane->cache['method'] == 'esi') {
// ESI panes are always rendered (access callbacks)
return TRUE;
}
return panels_pane_access($pane, $this->display);
}
/**
* Perform display/layout-level render operations.
*
* This method triggers all the inner pane/region rendering processes, passes
* that to the layout plugin's theme callback, and returns the rendered HTML.
*
* If display-level caching is enabled and that cache is warm, this method
* will not be called.
*
* @return string
* The HTML string representing the entire rendered, themed panel.
*/
function render_layout() {
if (empty($this->prep_run)) {
$this
->prepare();
}
// Get the default rendering of the panes.
$this
->render_panes();
// Replace content with ESI tags, as needed.
$this
->handle_esi();
$this
->render_regions();
if ($this->admin && !empty($this->plugins['layout']['admin theme'])) {
$theme = $this->plugins['layout']['admin theme'];
}
else {
$theme = $this->plugins['layout']['theme'];
}
$this->rendered['layout'] = theme($theme, array(
'css_id' => check_plain($this->display->css_id),
'content' => $this->rendered['regions'],
'settings' => $this->display->layout_settings,
'display' => $this->display,
'layout' => $this->plugins['layout'],
'renderer' => $this,
));
return $this->prefix . $this->rendered['layout'] . $this->suffix;
}
/**
* Parse the rendered panes, replacing the ESI-handled panes with ESI tags.
*/
function handle_esi() {
foreach ($this->prepared['panes'] as $pid => $pane) {
if (!empty($pane->cache) && $pane->cache['method'] == 'esi') {
$this
->handle_esi_pane($pane);
}
}
}
/**
* Replace a pane's rendered content with ESI content.
*/
function handle_esi_pane($pane) {
// Get the initial output.
$url = url(esi_panels_url($pane, $this->display), array(
'absolute' => TRUE,
));
$render = array(
'#type' => 'esi',
'#url' => $url,
);
$output = drupal_render($render);
// If there are region locks, add them.
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'regions') {
static $key = NULL;
$javascript =& drupal_static('drupal_add_js', array());
// drupal_add_js breaks as we add these, but we can't just lump them
// together because panes can be rendered independently. So game the system:
if (empty($key)) {
$settings['Panels']['RegionLock'][$pane->pid] = $pane->locks['regions'];
drupal_add_js($settings, 'setting');
// These are just added via [] so we have to grab the last one
// and reference it.
$keys = array_keys($javascript['settings']['data']);
$key = end($keys);
}
else {
$javascript['settings']['data'][$key]['Panels']['RegionLock'][$pane->pid] = $pane->locks['regions'];
}
}
if (empty($pane->IPE_empty)) {
// Add an inner layer wrapper to the pane content before placing it into
// draggable portlet
$output = "<div class=\"panels-ipe-portlet-content\">{$output}</div>";
}
else {
$output = "<div class=\"panels-ipe-portlet-content panels-ipe-empty-pane\">{$output}</div>";
}
// Hand it off to the plugin/theme for placing draggers/buttons
$output = theme('panels_ipe_pane_wrapper', array(
'output' => $output,
'pane' => $pane,
'display' => $this->display,
'renderer' => $this,
));
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'immovable') {
return "<div id=\"panels-ipe-paneid-{$pane->pid}\" class=\"panels-ipe-nodrag panels-ipe-portlet-wrapper panels-ipe-portlet-marker\">" . $output . "</div>";
}
$result = "<div id=\"panels-ipe-paneid-{$pane->pid}\" class=\"panels-ipe-portlet-wrapper panels-ipe-portlet-marker\">" . $output . "</div>";
$this->rendered['panes'][$pane->pid] = $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
esi_panels_renderer_ipe:: |
function | Parse the rendered panes, replacing the ESI-handled panes with ESI tags. | ||
esi_panels_renderer_ipe:: |
function | Replace a pane's rendered content with ESI content. | ||
esi_panels_renderer_ipe:: |
function | Test if a pane (or ESI tag) should be rendered. Normal panes are checked for visibility and access-control rules. Panes rendered by ESI are just checked for visibility. | ||
esi_panels_renderer_ipe:: |
function |
Prepare the list of panes to be rendered, accounting for visibility/access
settings and rendering order. Overrides panels_renderer_ipe:: |
||
esi_panels_renderer_ipe:: |
function |
Perform display/layout-level render operations. Overrides panels_renderer_standard:: |
||
panels_renderer_editor:: |
property | An array of AJAX commands to return. If populated it will automatically be used by the AJAX router. | ||
panels_renderer_editor:: |
property | Set to true if edit links (for panes and regions) should not be displayed. This can be used for special edit modes such as layout change and layout builder that do not actually have real content. | ||
panels_renderer_editor:: |
function | AJAX entry point for to add a visibility rule. | ||
panels_renderer_editor:: |
function | AJAX entry point for to configure vsibility rule. | ||
panels_renderer_editor:: |
function | AJAX entry point to configure access settings for a pane. | ||
panels_renderer_editor:: |
function | AJAX entry point to add a new pane. | ||
panels_renderer_editor:: |
function | AJAX entry point to configure the cache method for a pane or the display. | ||
panels_renderer_editor:: |
function | AJAX entry point to configure the cache settings for a pane or the display. | ||
panels_renderer_editor:: |
function | AJAX entry point to edit a pane. | ||
panels_renderer_editor:: |
function | AJAX command to show a pane. | ||
panels_renderer_editor:: |
function | AJAX Router function for layout owned AJAX calls. | ||
panels_renderer_editor:: |
function | AJAX entry point to configure CSS for a pane. | ||
panels_renderer_editor:: |
function | AJAX entry point to select which pane is currently the title. | ||
panels_renderer_editor:: |
function | AJAX entry point to configure CSS for a pane. | ||
panels_renderer_editor:: |
function | AJAX command to present a dialog with a list of available content. | ||
panels_renderer_editor:: |
function | AJAX command to show a pane. | ||
panels_renderer_editor:: |
function | AJAX Router function for style owned AJAX calls. | ||
panels_renderer_editor:: |
function | AJAX entry point to configure the style for a display, region or pane. | ||
panels_renderer_editor:: |
function | AJAX entry point to select the style for a display, region or pane. | ||
panels_renderer_editor:: |
function | Create a command to update the links on a display after a change was made. | ||
panels_renderer_editor:: |
function | Create a command to update the links on a region after a change was made. | ||
panels_renderer_editor:: |
function | Display edit rendering. | ||
panels_renderer_editor:: |
function | Create a list of categories from all of the content type. | ||
panels_renderer_editor:: |
function | Return the category name and the category key of a given content type. | ||
panels_renderer_editor:: |
function | Get the links for a panel display. | ||
panels_renderer_editor:: |
function | Render the links to display when editing a pane. | ||
panels_renderer_editor:: |
function | Render the links to display when editing a region. | ||
panels_renderer_editor:: |
function | Get the appropriate style from the panel in the cache. | ||
panels_renderer_editor:: |
function | Get the style links. | ||
panels_renderer_editor:: |
function | Generate a URL path for the AJAX editor. | ||
panels_renderer_ipe:: |
property | |||
panels_renderer_ipe:: |
property |
TRUE if this renderer is rendering in administrative mode
which will allow layouts to have extra functionality. Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function | |||
panels_renderer_ipe:: |
function |
Attach out-of-band page metadata (e.g., CSS and JS). Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function | AJAX entry point to create the controller form for an IPE. | ||
panels_renderer_ipe:: |
function | AJAX entry point to create the controller form for an IPE. | ||
panels_renderer_ipe:: |
function | |||
panels_renderer_ipe:: |
function | AJAX callback to unlock the IPE. | ||
panels_renderer_ipe:: |
function |
Create a command array to add a new pane. Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function |
Create a command array to redraw a pane. Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function |
Get the Panels storage oparation for a given renderer AJAX method. Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function | |||
panels_renderer_ipe:: |
function | This is a generic lock test. | ||
panels_renderer_ipe:: |
function |
Build inner content, then hand off to layout-specified theme function for
final render step. Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function |
Override & call the parent, then pass output through to the dnd wrapper
theme function. Overrides panels_renderer_editor:: |
||
panels_renderer_ipe:: |
function |
Render the interior contents of a single pane. Overrides panels_renderer_standard:: |
||
panels_renderer_ipe:: |
function |
Add an 'empty' pane placeholder above all the normal panes. Overrides panels_renderer_editor:: |
||
panels_renderer_standard:: |
property | The fully-loaded Panels display object that is to be rendered. "Fully loaded" is defined as: 1. Having been produced by panels_load_displays(), whether or this page request or at some time in the past and the object was exported. 2. Having… | ||
panels_renderer_standard:: |
property | Where to add standard meta information. There are three possibilities: | ||
panels_renderer_standard:: |
property | The plugin that defines this handler. | ||
panels_renderer_standard:: |
property | An associative array of loaded plugins. Used primarily as a central location for storing plugins that require additional loading beyond reading the plugin definition, which is already statically cached by ctools_get_plugins(). An example is layout… | ||
panels_renderer_standard:: |
property | Include rendered HTML prior to the layout. | ||
panels_renderer_standard:: |
property | A multilevel array of data prepared for rendering. The first level of the array indicates the type of prepared data. The standard renderer populates and uses two top-level keys, 'panes' and 'regions': | ||
panels_renderer_standard:: |
property | Boolean state variable, indicating whether or not the prepare() method has been run. | ||
panels_renderer_standard:: |
property | A multilevel array of rendered data. The first level of the array indicates the type of rendered data, typically with up to three keys: 'layout', 'regions', and 'panes'. The relevant rendered data is stored as the value… | ||
panels_renderer_standard:: |
property | Boolean flag indicating whether to render the layout even if all rendered regions are blank. If FALSE, the layout renders as an empty string (without prefix or suffix) if not in administrative mode. | ||
panels_renderer_standard:: |
property | Include rendered HTML after the layout. | ||
panels_renderer_standard:: |
function | Add CSS information to the renderer. | ||
panels_renderer_standard:: |
function | Receive and store the display object to be rendered. | ||
panels_renderer_standard:: |
function | Prepare the attached display for rendering. | 1 | |
panels_renderer_standard:: |
function | Prepare the list of regions to be rendered. | ||
panels_renderer_standard:: |
function | Render all prepared panes, first by dispatching to their plugin's render callback, then handing that output off to the pane's style plugin. | 1 | |
panels_renderer_standard:: |
function | Render all prepared regions, placing already-rendered panes into their appropriate positions therein. | 1 |