function panels_page_load in Panels 5.2
Same name and namespace in other branches
- 6.2 panels_page/panels_page.read.inc \panels_page_load()
Load a panel page.
9 calls to panels_page_load()
- panels_page_delete_confirm in panels_page/
panels_page.admin.inc - Provide a form to confirm deletion of a panel page.
- panels_page_edit in panels_page/
panels_page.admin.inc - Edit a panel page.
- panels_page_edit_advanced in panels_page/
panels_page.admin.inc - Edit advanced settings of a panel page.
- panels_page_edit_content in panels_page/
panels_page.admin.inc - Pass through to the panels content editor.
- panels_page_edit_context in panels_page/
panels_page.admin.inc - Edit advanced settings of a panel page.
File
- panels_page/
panels_page.module, line 940 - panels_page.module
Code
function panels_page_load($pid, $load_display = FALSE) {
static $cache = array();
if (array_key_exists($pid, $cache)) {
if ($load_display && empty($cache[$pid]->display)) {
$cache[$pid]->display = panels_load_display($cache[$pid]->did);
}
return $cache[$pid];
}
if (!is_numeric($pid)) {
$where = "name = '%s'";
}
else {
$where = 'pid = %d';
}
$page = db_fetch_object(db_query("SELECT * FROM {panels_page} WHERE {$where}", $pid));
if (!$page) {
$defaults = panels_page_default_panels();
if (isset($defaults[$pid])) {
$page = $cache[$pid] = $defaults[$pid];
$page->primary = $page->display;
return $page;
}
return;
}
$page->access = $page->access ? explode(', ', $page->access) : array();
$page->arguments = !empty($page->arguments) ? unserialize($page->arguments) : array();
$page->displays = !empty($page->displays) ? unserialize($page->displays) : array();
$page->contexts = !empty($page->contexts) ? unserialize($page->contexts) : array();
$page->relationships = !empty($page->relationships) ? unserialize($page->relationships) : array();
$page->switcher_options = !empty($page->switcher_options) ? unserialize($page->switcher_options) : array();
if ($load_display) {
$page->display = panels_load_display($page->did);
}
$cache[$pid] = panels_page_sanitize($page);
// Make sure that we've statically cached the loaded page for both possible
// unique identifiers - $page->pid AND $page->name.
$other_id = is_numeric($pid) || $pid == 'new' ? $page->name : $page->pid;
$cache[$other_id] =& $cache[$pid];
return $cache[$pid];
}