You are here

function esi_panels__esi_pane_render in ESI: Edge Side Includes 7.3

Render the HTML for a single block. Defined in hook_esi_component_info().

See also

esi_panels_esi_component_info()

1 string reference to 'esi_panels__esi_pane_render'
esi_panels_esi_component_info in modules/esi_panels/esi_panels.module
Implements hook_esi_component().

File

modules/esi_panels/esi_panels.esi.inc, line 136

Code

function esi_panels__esi_pane_render($pane) {

  // Much of this is from the "standard" display renderer:
  // see panels_renderer_standard::prepare().
  ctools_include('content');
  $content_type = ctools_get_content_type($pane->type);

  // Check access control; if the user doesn't have access, simply return an
  // empty string.
  // ctools_include('context');
  // if ($pane->access && !empty($pane->display_contexts) && ctools_access($pane->access, $pane->display_contexts)) {
  //   return '';
  // }
  $content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $pane->esi_meta['display_args'], $pane->esi_meta['display_contexts']);
  if (empty($content)) {
    return '';
  }
  foreach (module_implements('panels_pane_content_alter') as $module) {
    $function = $module . '_panels_pane_content_alter';
    $function($content, $pane, $pane->esi_meta['display_args'], $pane->esi_meta['display_contexts']);
  }
  esi_panels_set_http_headers($pane);

  // Pass long the css_id that is usually available.
  if (!empty($pane->css['css_id'])) {
    $content->css_id = check_plain($pane->css['css_id']);
  }

  // Pass long the css_class that is usually available.
  if (!empty($pane->css['css_class'])) {
    $content->css_class = check_plain($pane->css['css_class']);
  }
  if (!empty($content->content)) {
    if (!empty($pane->style['style'])) {
      $style = panels_get_style($pane->style['style']);
      if (isset($style) && isset($style['render pane'])) {
        $output = theme($style['render pane'], array(
          'content' => $content,
          'pane' => $pane,
          'display' => $this->display,
          'style' => $style,
          'settings' => $pane->style['settings'],
        ));

        // This could be null if no theme function existed.
        if (isset($output)) {
          return $output;
        }
      }
    }

    // Fallback.
    return theme('panels_pane', array(
      'content' => $content,
      'pane' => $pane,
      'display' => $pane->esi_meta['display'],
    ));
  }
}