function panels_mini_load_all in Panels 5.2
Same name and namespace in other branches
- 6.3 panels_mini/panels_mini.module \panels_mini_load_all()
- 6.2 panels_mini/panels_mini.module \panels_mini_load_all()
- 7.3 panels_mini/panels_mini.module \panels_mini_load_all()
Fetch all mini panels in the system.
This function does not cache.
4 calls to panels_mini_load_all()
- panels_mini_block in panels_mini/
panels_mini.module - Implementation of hook_block().
- panels_mini_content_types in panels_mini/
panels_mini.module - Return each available mini panel available as a subtype.
- panels_mini_list_page in panels_mini/
panels_mini.module - Provide a list of mini panels, with links to edit or delete them.
- panels_mini_panels_exportables in panels_mini/
panels_mini.module - Implementation of hook_panels_exportables().
File
- panels_mini/
panels_mini.module, line 1005 - panels_mini.module
Code
function panels_mini_load_all($page_size = 0) {
static $results = array();
if (array_key_exists($page_size, $results)) {
return $results[$page_size];
}
$panels = $dids = array();
$query = "SELECT * FROM {panels_mini}";
if ($page_size) {
$result = pager_query($query, $page_size);
}
else {
$result = db_query($query);
}
while ($panel_mini = db_fetch_object($result)) {
$panel_mini->contexts = !empty($panel_mini->contexts) ? unserialize($panel_mini->contexts) : array();
$panel_mini->requiredcontexts = !empty($panel_mini->requiredcontexts) ? unserialize($panel_mini->requiredcontexts) : array();
$panel_mini->relationships = !empty($panel_mini->relationships) ? unserialize($panel_mini->relationships) : array();
$panel_mini->category = !empty($panel_mini->category) ? $panel_mini->category : 'Mini panels';
$panel_mini->hide_title = (bool) db_result(db_query('SELECT hide_title FROM {panels_display} WHERE did = %d', $panel_mini->did));
$panel_mini->type = t('Local');
$panels[$panel_mini->name] = panels_mini_sanitize($panel_mini);
}
$status = variable_get('panel_mini_defaults', array());
foreach (panels_mini_default_panels() as $panel_mini) {
// Determine if default panel is enabled or disabled.
if (isset($status[$panel_mini->name])) {
$panel_mini->disabled = $status[$panel_mini->name];
}
if (!empty($panels[$panel_mini->name])) {
$panels[$panel_mini->name]->type = t('Overridden');
}
else {
$panel_mini->type = t('Default');
$panels[$panel_mini->name] = $panel_mini;
}
}
$results[$page_size] = $panels;
return $results[$page_size];
}