You are here

function panels_node_view in Panels 5.2

Same name and namespace in other branches
  1. 6.3 panels_node/panels_node.module \panels_node_view()
  2. 6.2 panels_node/panels_node.module \panels_node_view()

Implementation of hook_view().

File

panels_node/panels_node.module, line 301
panels_node.module

Code

function panels_node_view($node, $teaser = FALSE, $page = FALSE) {
  panels_load_include('plugins');
  if ($teaser) {

    // Do the standard view for teaser.
    $node = node_prepare($node, $teaser);
  }
  else {
    $display = panels_load_display($node->panels_node['did']);
    $display->css_id = $node->panels_node['css_id'];

    // TODO: Find a way to make sure this can't node_view.
    $display->context = array(
      'panel-node' => panels_context_create('node', $node),
    );

    // Load additional contexts.
    $panel_node = (object) $node->panels_node;
    $display->context += panels_context_load_contexts($panel_node);
    $node->content['body'] = array(
      '#value' => panels_render_display($display),
      '#weight' => 0,
    );
  }
  return $node;
}