block.inc 1.2 KB

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