You are here

function panels_render_layout in Panels 6.3

Same name and namespace in other branches
  1. 5.2 panels.module \panels_render_layout()
  2. 6.2 includes/display-render.inc \panels_render_layout()

Given a full layout structure and a content array, render a panel display.

Deprecated

This function represents an old approach to rendering, and is retained only as a temporary support for other modules still using that approach. It will be removed in the next major version of Panels.

Related topics

File

./panels.module, line 1630
panels.module

Code

function panels_render_layout($layout, $content, $css_id = NULL, $settings = array(), $display = NULL) {
  if (!empty($layout['css'])) {
    if (file_exists(path_to_theme() . '/' . $layout['css'])) {
      drupal_add_css(path_to_theme() . '/' . $layout['css']);
    }
    else {
      drupal_add_css($layout['path'] . '/' . $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 $content is an object, it's a $display and we have to render its panes.
  if (is_object($content)) {
    $display = $content;
    if (empty($display->cache['method'])) {
      $content = panels_render_panes($display);
    }
    else {
      $cache = panels_get_cached_content($display, $display->args, $display->context);
      if ($cache === FALSE) {
        $cache = new panels_cache_object();
        $cache
          ->set_content(panels_render_panes($display));
        panels_set_cached_content($cache, $display, $display->args, $display->context);
      }
      $content = $cache->content;
    }
  }
  $output = theme($layout['theme'], check_plain($css_id), $content, $settings, $display);
  return $output;
}