_trigger_normalize_node_context

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/trigger/trigger.module, строка 195

Версии
6
_trigger_normalize_node_context($type, $node)

When an action is called in a context that does not match its type, the object that the action expects must be retrieved. For example, when an action that works on users is called during the node hook, the user object is not available since the node hook doesn't pass it. So here we load the object the action expects.

Параметры

$type The type of action that is about to be called.

$node The node that was passed via the nodeapi hook.

Возвращаемое значение

The object expected by the action that is about to be called.

Код

<?php
function _trigger_normalize_node_context($type, $node) {
  switch ($type) {
    // If an action that works on comments is being called in a node context,
    // the action is expecting a comment object. But we do not know which comment
    // to give it. The first? The most recent? All of them? So comment actions
    // in a node context are not supported.

    // An action that works on users is being called in a node context.
    // Load the user object of the node's author.
    case 'user':
      return user_load(array('uid' => $node->uid));
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему