Index: includes/display-render.inc =================================================================== --- includes/display-render.inc (revision 3062) +++ includes/display-render.inc (working copy) @@ -8,6 +8,44 @@ */ /** + * Given a full layout structure and a content array, render a panel display. + * @render + */ +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; +} + +/** * Render the administrative layout of a display. * * This is used for the edit version, so that layouts can have different