The implementation of hook_action_info() in version 7.x-1.3 of this module looks like it is using the Drupal 6 API when returning its structured array.
$actions['custom_pub_on_action'] = array(
'label' => 'Toggle a Custom Publishing Option on',
'type' => 'node',
'description' => t('Toggle a Custom Publishing Option on'),
'configurable' => TRUE,
'behavior' => array('changes_node_property'),
'hooks' => array(
'nodeapi' => array('presave'),
'comment' => array('insert', 'update'),
),
);
Based on the documentation for D7 API here:
https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...
the 'hooks' attribute from D6 API doesn't exist anymore. Also, the only valid value for 'behavior' is 'changes_property', not 'changes_node_property'. I think the correct version should look something like
$actions['custom_pub_on_action'] = array(
'label' => 'Toggle a Custom Publishing Option on',
'type' => 'node',
'description' => t('Toggle a Custom Publishing Option on'),
'configurable' => TRUE,
'triggers' => array('node_presave', 'comment_insert', 'comment_update'),
'behavior' => array('changes_property'),
),
);
My guess is this might also have something to do with why node_save() is having to be manually called in the custom_pub_on_action() and custom_pub_off_action() functions. If the 'changes_property' were there, I think node_save() would get called after your action function returned. I'm basing that on this note in the hook_action_info() documentation:
If an action with this behavior is assigned to a trigger other than a "presave" hook, any save actions also assigned to this trigger are moved later in the list. If no save action is present, one will be added.
I will work on a patch in the next couple of days to test this.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | patch.diff | 2.66 KB | ajm8372 |
Comments
Comment #1
ajm8372 commentedAttached a patch that seems to work as described above. I updated hook_action_info() to use the D7 API, and removed the redundant call to node_save() in the custom_pub_on_action() and custom_pub_off_action() functions.
Comment #2
kevinquillen commentedComment #3
dbazuin commentedI can confirm that this patch works.
Comment #5
vladimirausRerolled patch.
Thanks everyone.