1 |
85ad3d82
|
Assos Assos
|
<?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 |
|
|
|
35 |
|
|
$block->region = $pane->panel;
|
36 |
|
|
if (!isset($block->module)) {
|
37 |
|
|
$block->module = $block->type;
|
38 |
|
|
}
|
39 |
|
|
if (!isset($block->delta)) {
|
40 |
|
|
$block->delta = $block->subtype;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
$build = $block->content;
|
44 |
|
|
if (is_string($build)) {
|
45 |
|
|
$build = array('#markup' => $build);
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
$build['#block'] = $block;
|
49 |
|
|
$build['#theme_wrappers'][] = 'block';
|
50 |
|
|
|
51 |
|
|
// If using per pane classes, $block->css_class will need to be added in your
|
52 |
|
|
// preprocess or template, along with any other Panels specific field you
|
53 |
|
|
// might want to utilize.
|
54 |
|
|
return drupal_render($build);
|
55 |
|
|
}
|