function panels_mini_load_all in Panels 7.3
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()
- 6.2 panels_mini/panels_mini.module \panels_mini_load_all()
Load all mini panels.
4 calls to panels_mini_load_all()
- panels_mini_block_info in panels_mini/
panels_mini.module - Implementation of hook_block_info().
- panels_mini_block_list_alter in panels_mini/
panels_mini.module - Implements hook_block_list_alter().
- panels_mini_panels_dashboard_blocks in panels_mini/
panels_mini.module - Implementation of hook_panels_dashboard_blocks().
- panels_mini_panels_mini_content_type_content_types in panels_mini/
plugins/ content_types/ panels_mini.inc - Return each available mini panel available as a subtype.
2 string references to 'panels_mini_load_all'
- panels_mini_load in panels_mini/
panels_mini.module - Load a single mini panel.
- panels_mini_schema_1 in panels_mini/
panels_mini.install - Schema version 1 for Panels in D6.
File
- panels_mini/
panels_mini.module, line 330 - panels_mini.module
Code
function panels_mini_load_all($reset = FALSE) {
$cache =& drupal_static('panels_mini_load_all', array());
static $all_loaded = FALSE;
// We check our own private static because individual minis could have
// been loaded prior to load all and we need to know that.
if (!$all_loaded || $reset) {
$all_loaded = TRUE;
if ($reset) {
$cache = array();
}
else {
$panel_names = db_select('panels_mini', 'pm')
->fields('pm', array(
'name',
))
->execute();
$cids = array();
foreach ($panel_names as $name) {
$cids[] = 'panels_mini_load:' . $name->name;
}
$output = cache_get_multiple($cids, 'cache_panels');
foreach ($output as $mini) {
if (!empty($mini->data)) {
$mini = $mini->data;
$cache[$mini->name] = $mini;
}
}
}
ctools_include('export');
$minis = ctools_export_load_object('panels_mini');
$dids = array();
foreach ($minis as $mini) {
if (empty($cache[$mini->name])) {
if (!empty($mini->did)) {
$dids[$mini->did] = $mini->name;
}
else {
// Translate old style titles into new titles.
if (!empty($mini->title) && empty($mini->display->title)) {
$mini->display->title = $mini->title;
}
}
// Translate old style titles into new titles.
if (isset($mini->title) && empty($mini->admin_title)) {
$mini->admin_title = $mini->title;
}
$cache[$mini->name] = $mini;
}
}
$displays = panels_load_displays(array_keys($dids));
foreach ($displays as $did => $display) {
if (!empty($cache[$dids[$did]]->title) && empty($display->title)) {
$display->title = $cache[$dids[$did]]->title;
}
$cache[$dids[$did]]->display = $display;
}
}
// Strip out NULL entries that may have been added by panels_mini_load().
return array_filter($cache);
}