本文整理汇总了PHP中panels_pane_access函数的典型用法代码示例。如果您正苦于以下问题:PHP panels_pane_access函数的具体用法?PHP panels_pane_access怎么用?PHP panels_pane_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了panels_pane_access函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pane_should_be_rendered
/**
* 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);
}
示例2: render_pane_content
function render_pane_content(&$pane)
{
if (!empty($pane->shown) && panels_pane_access($pane, $this->display)) {
$content = parent::render_pane_content($pane);
}
// Ensure that empty panes have some content.
if (empty($content) || empty($content->content)) {
if (empty($content)) {
$content = new stdClass();
}
// Get the administrative title.
$content_type = ctools_get_content_type($pane->type);
$title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
$content->content = t('Placeholder for empty or inaccessible "@title"', array('@title' => html_entity_decode($title, ENT_QUOTES)));
// Add these to prevent notices.
$content->type = 'panels_ipe';
$content->subtype = 'panels_ipe';
$pane->IPE_empty = TRUE;
}
return $content;
}
示例3: prepare_panes
/**
* 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 & access 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)
{
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 visible to the user, skip out and do the next one
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;
}
}
}
$this->prepared['panes'] = $first + $normal + $last;
return $this->prepared['panes'];
}
示例4: render_regions
/**
* Render all panes in the attached display into their panel regions, then
* render those regions.
*
* @return array $content
* An array of rendered panel regions, keyed on the region name.
*/
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;
}