You are here

function panels_render_layout in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels.module \panels_render_layout()
  2. 6.3 panels.module \panels_render_layout()

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

3 calls to panels_render_layout()
theme_panels_edit_display_form in includes/display-edit.inc
Theme the edit display form.
_panels_print_layout in includes/display-render.inc
For external use: Given a layout ID and a $content array, return the panel display. The content array is filled in based upon the content available in the layout. If it's a two column with a content array defined like array('left' =>…
_panels_render_display in includes/display-render.inc
Render a display by loading the content into an appropriate array and then passing through to panels_render_layout.

File

includes/display-render.inc, line 67
Contains Panels display rendering functions.

Code

function panels_render_layout($layout, $content, $css_id = NULL, $settings = array()) {
  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']);
    }
  }
  $display = NULL;

  // 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;
}