You are here

function panels_renderer_legacy::render in Panels 6.3

Builds inner content, then hands off to layout-specified theme function for final render step.

This is the outermost method in the Panels render pipeline. It calls the inner methods, which return a content array, which is in turn passed to the theme function specified in the layout plugin.

Return value

string Themed & rendered HTML output.

File

plugins/display_renderers/panels_renderer_legacy.class.php, line 101

Class

panels_renderer_legacy
Legacy render pipeline for a panels display.

Code

function render() {
  if (!empty($this->plugins['layout']['css'])) {
    if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) {
      drupal_add_css(path_to_theme() . '/' . $this->plugins['layout']['css']);
    }
    else {
      drupal_add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['css']);
    }
  }

  // This now comes after the CSS is added, because panels-within-panels must
  // have their CSS added in the right order; inner content before outer content.
  if (empty($this->display->cache['method']) || !empty($this->display->skip_cache)) {
    $content = $this
      ->render_regions();
  }
  else {
    $cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context);
    if ($cache === FALSE) {
      $cache = new panels_cache_object();
      $cache
        ->set_content($this
        ->render_regions());
      panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context);
    }
    $content = $cache->content;
  }
  $output = theme($this->plugins['layout']['theme'], check_plain($this->display->css_id), $content, $this->display->layout_settings, $this->display, $this->plugins['layout'], $this);
  return $this->prefix . $output . $this->suffix;
}