You are here

function _acquia_lift_get_page_context in Acquia Lift Connector 7.3

Handles the 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.

1 call to _acquia_lift_get_page_context()
acquia_lift_get_page_context in ./acquia_lift.module
Gets the page context data.

File

./acquia_lift.context.inc, line 70
acquia_lift.context.inc Provides functions needed for handling visitor contexts.

Code

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

  // Get global language to set as 'context_language'
  // Note: Language will always be set as there is a default fallback
  global $language;

  // Add context language
  $page_context['context_language'] = $language->language;

  // 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;
    $page_context['content_uuid'] = isset($node->uuid) ? $node->uuid : '';
    $page_context['page_type'] = 'node page';
    $page_context = array_merge_recursive($page_context, _acquia_lift_get_mapped_context($node));
  }
  return $page_context;
}