You are here

function panels_render_pane_content in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/display-render.inc \panels_render_pane_content()

Render a single pane, identifying its context, and put it into the $panes array.

1 call to panels_render_pane_content()
panels_render_panes in ./panels.module
Render all the panes in a display into a $content array to be used by the display theme function.

File

./panels.module, line 1058
panels.module Core API for Panels. Provides display editing and rendering capabilities.

Code

function panels_render_pane_content(&$display, &$pane) {
  if (empty($pane->context)) {
    $pane->context = panels_pane_select_context($pane, $display->context);
    if ($pane->context === FALSE) {
      return FALSE;
    }
  }
  $content = panels_get_pane_content($display, $pane, $display->args, $pane->context, $display->incoming_content);
  $keywords = !empty($display->keywords) ? $display->keywords : array();

  // Override the title if configured to
  if (!empty($pane->configuration['override_title'])) {

    // Give previous title as an available substitution here.
    $keywords['%title'] = $content->title;
    $content->title = $pane->configuration['override_title_text'];
  }

  // Pass long the css_id that is usually available.
  if (!empty($pane->configuration['css_id'])) {
    $content->css_id = $pane->configuration['css_id'];
  }

  // Pass long the css_class that is usually available.
  if (!empty($pane->configuration['css_class'])) {
    $content->css_class = $pane->configuration['css_class'];
  }
  if (!empty($content->title)) {

    // Perform substitutions
    if (!empty($keywords)) {
      $content->title = strtr($content->title, $keywords);
    }

    // Sterilize the title
    $content->title = filter_xss_admin($content->title);

    // If a link is specified, populate.
    if (!empty($content->title_link)) {
      if (!is_array($content->title_link)) {
        $url = array(
          'href' => $content->title_link,
        );
      }
      else {
        $url = $content->title_link;
      }

      // set defaults so we don't bring up notices
      $url += array(
        'href' => '',
        'attributes' => NULL,
        'query' => NULL,
        'fragment' => NULL,
        'absolute' => NULL,
      );
      $content->title = l($content->title, $url['href'], $url['attributes'], $url['query'], $url['fragment'], $url['absolute'], TRUE);
    }
  }
  return $content;
}