You are here

function panels_print_layout in Panels 8.3

Same name and namespace in other branches
  1. 5.2 panels.module \panels_print_layout()
  2. 5 panels.module \panels_print_layout()
  3. 6.3 panels.module \panels_print_layout()
  4. 6.2 panels.module \panels_print_layout()
  5. 7.3 panels.module \panels_print_layout()

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' => t('Left side'),
   'right' => t('Right side')
 ),

Then the $content array should be

array(
  'left' => $output_left,
  'right' => $output_right,
);

The output within each panel region can be either a single rendered HTML string or an array of rendered HTML strings as though they were panes. They will simply be concatenated together without separators.

Related topics

File

./panels.module, line 1501
panels.module

Code

function panels_print_layout($layout, $content, $meta = 'standard') {
  ctools_include('plugins', 'panels');

  // Create a temporary display for this.
  $display = panels_new_display();
  $display->layout = is_array($layout) ? $layout['name'] : $layout;
  $display->content = $content;

  // Get our simple renderer
  $renderer = panels_get_renderer_handler('simple', $display);
  $renderer->meta_location = $meta;
  return $renderer
    ->render();
}