You are here

function panels_renderer_ipe::render_pane in Panels 7.3

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

Override & call the parent, then pass output through to the dnd wrapper theme function.

Parameters

$pane:

Overrides panels_renderer_editor::render_pane

2 calls to panels_renderer_ipe::render_pane()
panels_renderer_ipe::command_add_pane in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
Create a command array to add a new pane.
panels_renderer_ipe::command_update_pane in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
Create a command array to redraw a pane.

File

panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php, line 129

Class

panels_renderer_ipe
Renderer class for all In-Place Editor (IPE) behavior.

Code

function render_pane(&$pane) {

  // Temporarily change $_GET['q'] so that panes think the current path is
  // the original path when rendering.
  $ajax_path = $_GET['q'];
  if (!empty($_GET['destination'])) {
    $_GET['q'] = $_GET['destination'];
  }
  $output = parent::render_pane($pane);

  // Reset $_GET['q'] to the AJAX path.
  $_GET['q'] = $ajax_path;
  if (empty($output)) {
    return;
  }
  if (!$this
    ->access()) {
    return $output;
  }

  // If there are region locks, add them.
  if (!empty($pane->locks['type']) && $pane->locks['type'] == 'regions') {
    static $key = NULL;
    $javascript =& drupal_static('drupal_add_js', array());

    // drupal_add_js breaks as we add these, but we can't just lump them
    // together because panes can be rendered independently. So game the system:
    if (empty($key)) {
      $settings['Panels']['RegionLock'][$pane->pid] = $pane->locks['regions'];
      drupal_add_js($settings, 'setting');

      // These are just added via [] so we have to grab the last one
      // and reference it.
      $keys = array_keys($javascript['settings']['data']);
      $key = end($keys);
    }
    else {
      $javascript['settings']['data'][$key]['Panels']['RegionLock'][$pane->pid] = $pane->locks['regions'];
    }
  }
  if (empty($pane->IPE_empty)) {

    // Add an inner layer wrapper to the pane content before placing it into
    // draggable portlet.
    $output = "<div class=\"panels-ipe-portlet-content\">{$output}</div>";
  }
  else {
    $output = "<div class=\"panels-ipe-portlet-content panels-ipe-empty-pane\">{$output}</div>";
  }

  // Hand it off to the plugin/theme for placing draggers/buttons.
  $output = theme('panels_ipe_pane_wrapper', array(
    'output' => $output,
    'pane' => $pane,
    'display' => $this->display,
    'renderer' => $this,
  ));
  if (!empty($pane->locks['type']) && $pane->locks['type'] == 'immovable') {
    return "<div id=\"panels-ipe-paneid-{$pane->pid}\" class=\"panels-ipe-nodrag panels-ipe-portlet-wrapper panels-ipe-portlet-marker\">" . $output . "</div>";
  }
  return "<div id=\"panels-ipe-paneid-{$pane->pid}\" class=\"panels-ipe-portlet-wrapper panels-ipe-portlet-marker\">" . $output . "</div>";
}