function panels_mini_block in Panels 5.2
Same name and namespace in other branches
- 6.3 panels_mini/panels_mini.module \panels_mini_block()
- 6.2 panels_mini/panels_mini.module \panels_mini_block()
Implementation of hook_block().
Expose qualifying mini panels to Drupal's block system.
File
- panels_mini/
panels_mini.module, line 807 - panels_mini.module
Code
function panels_mini_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks = array();
$minis = panels_mini_load_all();
foreach ($minis as $panel_mini) {
if (empty($panel_mini->disabled) && empty($panel_mini->requiredcontext)) {
$title = $panel_mini->hide_title ? t('Mini panel: %title (Title will be hidden)', array(
'%title' => $panel_mini->title,
)) : t('Mini panel: %title', array(
'%title' => $panel_mini->title,
));
$blocks[$panel_mini->pid] = array(
'info' => $title,
);
}
}
return $blocks;
}
elseif ($op == 'view') {
$panel_mini = panels_mini_load($delta);
panels_load_include('plugins');
$panel_mini->context = $panel_mini->display->context = panels_context_load_contexts($panel_mini);
$panel_mini->display->css_id = panels_mini_get_id($panel_mini->name);
$block = array(
'subject' => $panel_mini->hide_title ? '' : check_plain($panel_mini->title),
'content' => panels_render_display($panel_mini->display),
);
return $block;
}
}