You are here

function panels_renderer_standard::render_pane_content in Panels 7.3

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

Render the interior contents of a single pane.

This method retrieves pane content and produces a ready-to-render content object. It also manages pane-specific caching.

Parameters

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

Return value

stdClass $content A renderable object, containing a subject, content, etc. Based on the renderable objects used by the block system.

2 calls to panels_renderer_standard::render_pane_content()
panels_renderer_ipe::render_pane_content in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
Render the interior contents of a single pane.
panels_renderer_standard::render_pane in plugins/display_renderers/panels_renderer_standard.class.php
Render a pane using its designated style.
1 method overrides panels_renderer_standard::render_pane_content()
panels_renderer_ipe::render_pane_content in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
Render the interior contents of a single pane.

File

plugins/display_renderers/panels_renderer_standard.class.php, line 599

Class

panels_renderer_standard

Code

function render_pane_content(&$pane) {
  ctools_include('context');

  // TODO finally safe to remove this check?
  if (!is_array($this->display->context)) {
    watchdog('panels', 'renderer::render_pane_content() hit with a non-array for the context', $this->display, WATCHDOG_DEBUG);
    $this->display->context = array();
  }
  $caching = !empty($pane->cache['method']) && empty($this->display->skip_cache);
  if ($caching && ($cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context, $pane))) {
    $content = $cache->content;
  }
  else {
    if ($caching) {

      // This is created before rendering so that calls to drupal_add_js
      // and drupal_add_css will be captured.
      $cache = new panels_cache_object();
    }
    $content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $this->display->args, $this->display->context);
    foreach (module_implements('panels_pane_content_alter') as $module) {
      $function = $module . '_panels_pane_content_alter';
      $function($content, $pane, $this->display->args, $this->display->context, $this, $this->display);
    }
    if ($caching && isset($cache)) {
      $cache
        ->set_content($content);
      panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context, $pane);
      $content = $cache->content;
    }
  }

  // If there's content, check if we've css configuration to add.
  if (!empty($content)) {

    // Pass long the css_id that is usually available.
    if (!empty($pane->css['css_id'])) {
      $id = ctools_context_keyword_substitute($pane->css['css_id'], array(), $this->display->context);
      $content->css_id = check_plain($id);
    }

    // Pass long the css_class that is usually available.
    if (!empty($pane->css['css_class'])) {
      $class = ctools_context_keyword_substitute($pane->css['css_class'], array(), $this->display->context, array(
        'css safe' => TRUE,
      ));
      $content->css_class = check_plain($class);
    }
  }
  return $content;
}