I have the following question: I'm attempting to pass some additional information, let's say $showinfo, through hook_trigger_name() from a custom module like this:

  function module_name_module_name($op,$user,$node, $showinfo) {
    if (function_exists('_trigger_get_hook_aids')) {
      $aids = _trigger_get_hook_aids('module_name', $op);
    
      switch ($op) {
        case 'insert':
          $context = array(
            'hook' => 'module_name',
            'op' => $op,
            'user' => $user,
            'node' => $node,
            'showinfo' => $showinfo,
          );
          break;

      }
      if ($aids) {
        actions_do(array_keys($aids), $user, $context);
      }
    } 
  }

I also added the object to hook_activity_info()

function module_name_activity_info() {
  $info = new stdClass();
  $info->api = 2;
  $info->name = 'module_name';
  $info->object_type = 'user';
  $info->objects = array('user' => 'user', 'node' => 'node', 'showinfo' => 'showinfo'); // array keys are the labels
  $info->hooks = array('module_name' => array('insert'));
  $info->realms = array('module_name' => 'Module Name');
  return $info;
}

The goal is use the values in activity messages, but how do I make them appear as tokens? I think I'm missing one step, since it's not a node or user object it probably should be defined somewhere, but where?
Any help would be greatly appreciated!

Comments

Scott Reynolds’s picture

Status: Active » Needs review

Implement the hook_token_* hooks.

I think they are hook_token_list and hook_token_values for the type = 'showinfo'.

eelke’s picture

Status: Needs review » Fixed

That did the trick, thanks a lot for the suggestion.
Documentation on the suggested hooks can be found here: http://drupal.org/handbook/modules/token

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.