You are here

function panels_display::render in Panels 8.3

Same name and namespace in other branches
  1. 6.3 panels.module \panels_display::render()
  2. 7.3 panels.module \panels_display::render()

Render this panels display.

After checking to ensure the designated layout plugin is valid, a display renderer object is spawned and runs its rendering logic.

Parameters

mixed $renderer: An instantiated display renderer object, or the name of a display renderer plugin+class to be fetched. Defaults to NULL. When NULL, the predesignated display renderer will be used.

File

./panels.module, line 472
panels.module

Class

panels_display
Forms the basis of a panel display

Code

function render($renderer = NULL) {
  $layout = panels_get_layout($this->layout);
  if (!$layout) {
    return NULL;
  }

  // If we were not given a renderer object, load it.
  if (!is_object($renderer)) {

    // If the renderer was not specified, default to $this->renderer
    // which is either standard or was already set for us.
    $renderer = panels_get_renderer_handler(!empty($renderer) ? $renderer : $this->renderer, $this);
    if (!$renderer) {
      return NULL;
    }
  }
  $output = '';

  // Let modules act just prior to render.
  foreach (module_implements('panels_pre_render') as $module) {
    $function = $module . '_panels_pre_render';
    $output .= $function($this, $renderer);
  }
  $output .= $renderer
    ->render();

  // Let modules act just after render.
  foreach (module_implements('panels_post_render') as $module) {
    $function = $module . '_panels_post_render';
    $output .= $function($this, $renderer);
  }
  return $output;
}