You are here

function panels_renderer_editor::render_pane in Panels 7.3

Same name and namespace in other branches
  1. 6.3 plugins/display_renderers/panels_renderer_editor.class.php \panels_renderer_editor::render_pane()

Render a pane using its designated style.

This method also manages 'title pane' functionality, where the title from an individual pane can be bubbled up to take over the title for the entire display.

Parameters

object $pane: A Panels pane object, as loaded from the database.

Overrides panels_renderer_standard::render_pane

3 calls to panels_renderer_editor::render_pane()
panels_renderer_editor::command_add_pane in plugins/display_renderers/panels_renderer_editor.class.php
Create a command array to add a new pane.
panels_renderer_editor::command_update_pane in plugins/display_renderers/panels_renderer_editor.class.php
Create a command array to redraw a pane.
panels_renderer_ipe::render_pane in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
Override & call the parent, then pass output through to the dnd wrapper theme function.
1 method overrides panels_renderer_editor::render_pane()
panels_renderer_ipe::render_pane in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
Override & call the parent, then pass output through to the dnd wrapper theme function.

File

plugins/display_renderers/panels_renderer_editor.class.php, line 103
Class file to control the main Panels editor.

Class

panels_renderer_editor
@file Class file to control the main Panels editor.

Code

function render_pane(&$pane) {

  // Pass through to normal rendering if not in admin mode.
  if (!$this->admin) {
    return parent::render_pane($pane);
  }
  ctools_include('content');
  $content_type = ctools_get_content_type($pane->type);

  // This is just used for the title bar of the pane, not the content itself.
  // If we know the content type, use the appropriate title for that type,
  // otherwise, set the title using the content itself.
  $title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
  if (!$title) {
    $title = t('Deleted/missing content type @type', array(
      '@type' => $pane->type,
    ));
  }
  $buttons = $this
    ->get_pane_links($pane, $content_type);

  // Render administrative buttons for the pane.
  $block = new stdClass();
  if (empty($content_type)) {
    $block->title = '<em>' . t('Missing content type') . '</em>';
    $block->content = t('This pane\'s content type is either missing or has been deleted. This pane will not render.');
  }
  else {
    $block = ctools_content_admin_info($content_type, $pane->subtype, $pane->configuration, $this->display->context);
  }
  $grabber_class = 'grab-title grabber';

  // If there are region locks, add them.
  if (!empty($pane->locks['type'])) {
    if ($pane->locks['type'] == 'regions') {
      $settings['Panels']['RegionLock'][$pane->pid] = $pane->locks['regions'];
      drupal_add_js($settings, 'setting');
    }
    elseif ($pane->locks['type'] == 'immovable') {
      $grabber_class = 'grab-title not-grabber';
    }
  }
  $output = '';
  $class = 'panel-pane';
  if (empty($pane->shown)) {
    $class .= ' hidden-pane';
  }
  if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
    $class .= ' panel-pane-is-title';
  }
  $output = '<div class="' . $class . '" id="panel-pane-' . $pane->pid . '">';
  if (empty($block->title)) {
    $block->title = t('No title');
  }
  $output .= '<div class="' . $grabber_class . '">';
  if ($buttons) {
    $output .= '<span class="buttons">' . $buttons . '</span>';
  }
  $output .= '<span class="text" title="' . check_plain($title) . '">' . $title . '</span>';
  $output .= '</div>';

  // Grabber.
  $output .= '<div class="panel-pane-collapsible">';
  $output .= '<div class="pane-title">' . $block->title . '</div>';
  $output .= '<div class="pane-content">' . filter_xss_admin(render($block->content)) . '</div>';
  $output .= '</div>';

  // panel-pane-collapsible.
  $output .= '</div>';

  // panel-pane.
  return $output;
}