Closed (fixed)
Project:
Workflow
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2009 at 05:59 UTC
Updated:
4 Mar 2010 at 04:50 UTC
In the trigger module's trigger_assign_form(), the following code is run:
// Restrict the options list to actions that declare support for this hook-op
// combination.
foreach (actions_list() as $func => $metadata) {
if (isset($metadata['hooks']['any']) || (isset($metadata['hooks'][$hook]) && is_array($metadata['hooks'][$hook]) && (in_array($op, $metadata['hooks'][$hook])))) {
$functions[] = $func;
}
}
actions_list() calls hook_action_info() and hook_action_info_alter() in succession.
workflow's hook_action_info_alter() is:
function workflow_action_info_alter(&$info) {
foreach (array_keys($info) as $key) {
// Modify each action's hooks declaration, changing it to say
// that the action supports any hook.
$info[$key]['hooks'] = 'any';
}
}
Which just doesn't seem to mesh with what trigger_assign_form() is looking for.
It looks as if workflow should actually be setting something like this:
$info[$key]['hooks']['any'] = TRUE;
For example, node_action_info() defines:
'node_assign_owner_action' => array(
'type' => 'node',
'description' => t('Change the author of a post'),
'configurable' => TRUE,
'behavior' => array('changes_node_property'),
'hooks' => array(
'any' => TRUE,
'nodeapi' => array('presave'),
'comment' => array('delete', 'insert', 'update'),
),
),
And in fact, those are the only two instances of the quoted string "any" in Drupal 6 core, so I don't think I'm missing anything?
Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| workflow.module.patch | 414 bytes | jweowu |
Comments
Comment #1
heltem commentedSame issue here.
I agree with this patch.
Comment #2
jvandyk commentedFixed in 6.x-1.x-dev. There is no difference in functionality since isset($metadata['hooks']['any'] evaluates to TRUE either way.
Comment #3
heltem commentedDifference is for modules which try to do an array_merge() with the 'any' string (which fails) instead of the expected associated array.