You are here

function _ad_actions_normalize_context in Advertisement 7

Same name and namespace in other branches
  1. 6.3 actions/ad_actions.module \_ad_actions_normalize_context()
  2. 6.2 actions/ad_actions.module \_ad_actions_normalize_context()

Load, into the context, the common objects user and node so we can use their tokens. Somtimes Trigger, or Actions, load them for us, but sometimes not.

1 call to _ad_actions_normalize_context()
_ad_actions_send_email in actions/ad_actions.module

File

actions/ad_actions.module, line 426
Enable ad triggers and actions.

Code

function _ad_actions_normalize_context(&$context) {
  $context['global'] = NULL;
  if (empty($context['user']) && !empty($context['node'])) {
    $context['user'] = user_load(array(
      'uid' => $context['node']->uid,
    ));
  }
  if (empty($context['node']) && !empty($context['comment']) && !empty($context['comment']->nid)) {
    $context['node'] = node_load($context['comment']->nid);
  }
}