function panels_mini_load_all in Panels 6.2
Same name and namespace in other branches
- 5.2 panels_mini/panels_mini.module \panels_mini_load_all()
- 6.3 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.admin.inc - 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 228 - 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 ($mini = db_fetch_object($result)) {
$mini->contexts = !empty($mini->contexts) ? unserialize($mini->contexts) : array();
$mini->requiredcontexts = !empty($mini->requiredcontexts) ? unserialize($mini->requiredcontexts) : array();
$mini->relationships = !empty($mini->relationships) ? unserialize($mini->relationships) : array();
$mini->category = !empty($mini->category) ? $mini->category : 'Mini panels';
$mini->type = t('Local');
$panels[$mini->name] = panels_mini_sanitize($mini);
}
$status = variable_get('panel_mini_defaults', array());
foreach (panels_mini_default_panels() as $mini) {
// Determine if default panel is enabled or disabled.
if (isset($status[$mini->name])) {
$mini->disabled = $status[$mini->name];
}
if (!empty($panels[$mini->name])) {
$panels[$mini->name]->type = t('Overridden');
}
else {
$mini->type = t('Default');
$panels[$mini->name] = $mini;
}
}
$results[$page_size] = $panels;
return $results[$page_size];
}