You are here

function token_normalize_context in Token 6

Normalize an action context for use with token_replace_multiple().

3 calls to token_normalize_context()
token_actions_goto_action in ./token_actions.module
Action callback to redirect the user to a tokenized URL.
token_actions_message_action in ./token_actions.module
Action callback to send a message to the current user's screen.
token_actions_send_email_action in ./token_actions.module
Action callback to send a tokenized e-mail.

File

./token_actions.module, line 288
The Token Actions module.

Code

function token_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);
  }
  if (empty($context['user']) && !empty($context['account'])) {
    $context['user'] = $context['account'];
  }
}