Closed (fixed)
Project:
Activity
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 May 2010 at 16:05 UTC
Updated:
25 May 2010 at 19:40 UTC
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
Comment #1
Scott Reynolds commentedImplement the hook_token_* hooks.
I think they are hook_token_list and hook_token_values for the type = 'showinfo'.
Comment #2
eelke commentedThat did the trick, thanks a lot for the suggestion.
Documentation on the suggested hooks can be found here: http://drupal.org/handbook/modules/token