You are here

function acquia_lift_profiles_node_page_context in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift_profiles/acquia_lift_profiles.module \acquia_lift_profiles_node_page_context()

Handles the node-specific page context request data.

Parameters

$node: (optional) If passed then the taxonomy terms for the selected node are added to the page taxonomy context.

bool $primary: True if this is the primary node displayed for the page, false otherwise.

Return value

array Returns the taxonomy context for the page.

3 calls to acquia_lift_profiles_node_page_context()
acquia_lift_profiles_ctools_render_alter in acquia_lift_profiles/acquia_lift_profiles.module
Implements hook_ctools_render_alter().
acquia_lift_profiles_get_page_context in acquia_lift_profiles/acquia_lift_profiles.module
Gets the page context data.
acquia_lift_profiles_node_view in acquia_lift_profiles/acquia_lift_profiles.module
Implements hook_node_view().

File

acquia_lift_profiles/acquia_lift_profiles.module, line 449
acquia_lift_profiles.module Provides Acquia Lift Profiles integration.

Code

function acquia_lift_profiles_node_page_context($node = NULL, $primary = FALSE) {
  $page_context =& drupal_static(__FUNCTION__);
  if (!isset($page_context)) {
    $page_context = array();
  }

  // Add the content type of the page if this is the primary node displayed.
  if ($primary && empty($page_context['post_id'])) {
    $page_context['content_type'] = $node->type;
    $page_context['content_title'] = $node->title;
    $page_context['published_date'] = $node->created;
    $page_context['post_id'] = $node->nid;
    $account = user_load($node->uid);
    $page_context['author'] = $account->name;
    $page_context['page_type'] = 'node page';

    // Add the thumbnail image if specified in the content type and supplied.
    $page_context['thumbnail_url'] = acquia_lift_profiles_thumbnail_image('node', $node, $node->type);
  }

  // Allow other modules to alter the page context.
  drupal_alter('acquia_lift_profiles_page_context', $page_context);
  return $page_context;
}