workflow_action_info_alter() assigning incorrect 'any' value
jweowu - October 2, 2009 - 05:59
| Project: | Workflow |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
In the trigger module's trigger_assign_form(), the following code is run:
<?php
// 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:
<?php
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:
<?php
$info[$key]['hooks']['any'] = TRUE;
?>For example, node_action_info() defines:
<?php
'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.
| Attachment | Size |
|---|---|
| workflow.module.patch | 414 bytes |
