Hi, I'm having a good bit of trouble overriding the state transition box on my node edit form. I've had perfect luck overriding every other element on the page, however my function doesn't even register inside the workflow array. Here is my code:
if($form_id == 'job_posting_node_form') {
$form['taxonomy']['#title'] = 'Job tags';
$form['taxonomy']['#collapsible'] = FALSE;
$form['taxonomy']['#description'] = 'Pick some short tags to help describe the job.';
$form['workflow']['Job posting state']['#title'] = 'Optionally build your ad and save it for later or post it immediately.';
$form['workflow']['#collapsible'] = FALSE;
}
Shown above the workflow is an override that works as intended while the bottom two just do nothing. It seems as if this form is being altered after the form is built so should I rebuild this form? I would appreciate some guidance greatly. Thanks!
Comments
Comment #1
Bastlynn commentedCheck to make sure those values exist where you're making the change it's possible workflow is getting added to the form after your code runs, not before. If that's the case, then the standard workflow form is overriding your changes.
I don't have any example code to work with here (that's helpful), so I don't know what version of form_alter you're using to try to make the changes.
Comment #2
Bastlynn commentedI haven't heard back from you on this in awhile - so I'm going to assume you've gotten it taken care of. If not, let me know.
Comment #3
shendric commentedI'm actually having a similar issue. I have implemented hook_form_alter in a module, but it appears that the workflow form is getting added after my hook_form_alter, and so my changes are getting overridden. I only wanted to change the weight of the workflow form, so that it appears on the bottom. Is there any way I can do this?
Comment #4
Bastlynn commentedYou may want to try adding a weight to your module to be sure it executes after the workflow so you'll have something to override. Or you can try making your change in the afterbuild for the form. Either should let you get to the settings after workflow is done with them. Let me know if that works.
Comment #5
Bastlynn commentedI've not heard back from you on this, so I'm going to assume all is well and you've gotten this fixed up in afterbuild. Let me know if otherwise.