You are here

function forward_panels_node_render in Forward 7.3

Same name and namespace in other branches
  1. 7.2 plugins/content_types/forward_node.inc \forward_panels_node_render()
1 string reference to 'forward_panels_node_render'
forward_node.inc in plugins/content_types/forward_node.inc

File

plugins/content_types/forward_node.inc, line 11

Code

function forward_panels_node_render($subtype, $conf, $panel_args, $context) {
  if (empty($context) || empty($context->data)) {
    return;
  }
  if (!user_access('access forward')) {
    return;
  }

  // Get a shortcut to the node.
  $entity_type = 'node';
  $node = $context->data;
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $node);
  if (!$id) {
    return;
  }
  if (variable_get('forward_entity_' . $entity_type, FALSE) && variable_get('forward_' . $entity_type . '_' . $bundle, FALSE)) {

    // Build the link
    $widget_code = array(
      '#markup' => theme('forward_link', array(
        'entity_type' => $entity_type,
        'entity' => $node,
      )),
    );

    // Build the content type block.
    $block = new stdClass();
    $block->module = 'forward';
    $block->content = $widget_code;
    $block->delta = $node->nid;
    return $block;
  }
}