You are here

function panels_node_content_render in Panels 6.2

Output function for the 'node' content type.

Outputs a node based on the module and delta supplied in the configuration.

1 string reference to 'panels_node_content_render'
panels_node_panels_content_types in panels_node_content/panels_node_content.module
Implementation of hook_panels_content_types()

File

panels_node_content/panels_node_content.module, line 61
panels_node_content.module

Code

function panels_node_content_render($subtype, $conf, $panel_args) {
  $nid = $conf['nid'];
  $block = new stdClass();
  foreach (explode('/', $_GET['q']) as $id => $arg) {
    $nid = str_replace("%{$id}", $arg, $nid);
  }
  foreach ($panel_args as $id => $arg) {
    $nid = str_replace("@{$id}", $arg, $nid);
  }

  // Support node translation
  if (module_exists('translation')) {
    if ($translations = module_invoke('translation', 'node_get_translations', $nid)) {
      if ($translations[$GLOBALS['language']->language]) {
        $nid = $translations[$GLOBALS['language']->language]->nid;
      }
    }
  }
  if (!is_numeric($nid)) {
    return;
  }
  $node = node_load($nid);
  if (!node_access('view', $node)) {
    return;
  }
  if (node_access('update', $node)) {
    $block->admin_links['update'] = array(
      'title' => t('Edit node'),
      'alt' => t("Edit this node"),
      'href' => "node/{$node->nid}/edit",
      'query' => drupal_get_destination(),
    );
  }
  $block->module = 'node';
  $block->delta = $node->nid;
  $block->subject = $node->title;
  if (empty($conf['leave_node_title'])) {
    unset($node->title);
  }
  if (!empty($conf['identifier'])) {
    $node->panel_identifier = $conf['identifier'];
  }
  $block->content = node_view($node, $conf['teaser'], FALSE, $conf['links']);
  return $block;
}