You are here

function panels_content_node_content in Panels 6.2

Same name and namespace in other branches
  1. 5.2 content_types/node_content.inc \panels_content_node_content()

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_content_node_content'
panels_node_content_panels_content_types in content_types/node_content.inc
Callback function to supply a list of content types.

File

content_types/node_content.inc, line 41

Code

function panels_content_node_content($subtype, $conf, $panel_args, $context) {
  if (!empty($context) && empty($context->data)) {
    return;
  }
  $node = isset($context->data) ? drupal_clone($context->data) : NULL;
  $block = new stdClass();
  $block->module = 'node';
  $block->delta = $node->nid;
  if (empty($node)) {
    $block->delta = 'placeholder';
    $block->subject = t('Node title.');
    $block->content = t('Node content goes here.');
  }
  else {
    if (!empty($conf['identifier'])) {
      $node->panel_identifier = $conf['identifier'];
    }
    $block->subject = $node->title;

    //    unset($node->title);
    $block->content = panels_admin_node_content($node, $conf);
  }
  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(),
    );
  }
  if (!empty($conf['link']) && $node) {
    $block->title_link = "node/{$node->nid}";
  }
  return $block;
}