Closed (won't fix)
Project:
Workflow
Version:
6.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jun 2012 at 11:33 UTC
Updated:
9 Feb 2014 at 13:47 UTC
Jump to comment: Most recent
I have a lot of contribute modules, and I don't know how, but form['#node'] is set up in the comment form as well. As a result, the workflow form field shows up in my comment form even though the settings clearly say that they are for the node form only (of a particular content type).
I fixed this issue by changing the module form_alter function
function workflow_form_alter(&$form, $form_state, $form_id) {
// Ignore all forms except comment forms and node editing forms.
if ($form_id == 'comment_form' || (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id)) {
if (isset($form['#node'])) {
$node = $form['#node'];
// Abort if no workflow is assigned to this node type.
if (!in_array('node', variable_get('workflow_' . $node->type, array('node')))) {
return;
}
}
to
function workflow_form_alter(&$form, $form_state, $form_id) {
// Ignore all forms except comment forms and node editing forms.
if ($form_id == 'comment_form' || (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id)) {
//if (isset($form['#node'])) {
if ($form_id != 'comment_form') {
$node = $form['#node'];
// Abort if no workflow is assigned to this node type.
if (!in_array('node', variable_get('workflow_' . $node->type, array('node')))) {
return;
}
}
In the form_alter_hook of module, why do we do a chk on
if (isset($form['#node']))
and not
if ($form_id != 'comment_form') ??
thanks
Comments
Comment #1
kpv commented+1 for D7
Comment #2
johnvThis should be fixed in 7.x-2.x, so leaving it open for D6. (which is not maintained ATM)
Comment #3
johnvI wish there was a nicer way to clear the issue queue from 'D6-issues that are fixed in D7' then a "won't fix for D6."