1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of the 'block' panel style.
|
6
|
*/
|
7
|
|
8
|
// Plugin definition
|
9
|
$plugin = array(
|
10
|
'title' => t('System block'),
|
11
|
'description' => t('Display the pane as a system block; this is more restrictive than the default.'),
|
12
|
'render pane' => 'panels_block_style_render_pane',
|
13
|
'weight' => -10,
|
14
|
);
|
15
|
|
16
|
/**
|
17
|
* Render callback.
|
18
|
*
|
19
|
* @ingroup themeable
|
20
|
*/
|
21
|
function theme_panels_block_style_render_pane($vars) {
|
22
|
$content = $vars['content'];
|
23
|
$pane = $vars['pane'];
|
24
|
|
25
|
if (empty($content->content)) {
|
26
|
return;
|
27
|
}
|
28
|
|
29
|
$block = clone($content);
|
30
|
|
31
|
if (!empty($block->title)) {
|
32
|
$block->subject = $block->title;
|
33
|
}
|
34
|
if (!isset($block->subject)) {
|
35
|
$block->subject = '';
|
36
|
}
|
37
|
|
38
|
$block->region = $pane->panel;
|
39
|
if (!isset($block->module)) {
|
40
|
$block->module = $block->type;
|
41
|
}
|
42
|
if (!isset($block->delta)) {
|
43
|
$block->delta = $block->subtype;
|
44
|
}
|
45
|
|
46
|
$build = $block->content;
|
47
|
if (is_string($build)) {
|
48
|
$build = array('#markup' => $build);
|
49
|
}
|
50
|
|
51
|
$build['#block'] = $block;
|
52
|
$build['#theme_wrappers'][] = 'block';
|
53
|
|
54
|
// If using per pane classes, $block->css_class will need to be added in your
|
55
|
// preprocess or template, along with any other Panels specific field you
|
56
|
// might want to utilize.
|
57
|
return drupal_render($build);
|
58
|
}
|
59
|
|