Placement of Workflow settings on the node/add form

NonProfit's picture

Hi, First off, thanks to everyone who contributed to this module; it's great.

We've got Workflow up and running and it's working very well. We've hit a minor snag (which happens to be of great concern to the client) and it's my job to fix the problem.

We've applied Workflow to two content types;

Content Type A has the states:
draft
submitted
published
in-process
closed

Content Type B has the states:
draft
submitted
publish
expired

Content Type A's workflow sits at the top of the /node/add/[type] page and Type B's is much further down on its submission form. There are six developers working away on this site, so I'm sure Workflow is simply responding to a setting somebody set somewhere; but everyone on the team is denying involvement.

Any guidance as to how I can determine the placement of the Workflow settings on the node/add form would be greatly appreciated.

Thanks!

-NP

Groups:
Login to post comments

Need to adjust Workflow element weight with custom module

attheshow's picture
attheshow - Wed, 2009-05-13 18:30

Dear NonProfit,

I had the same issue you're describing. It seemed to me that the Workflow section appeared at a particular part of the page and could simply end up in the middle of a bunch of fields if there were a lot of fields on the page. To account for this, I have a site-specific module that I called "form_alterations". Here's the code that you'd need from the .module file:

/**
* Implementation of hook_form_alter().
*
* This lets you make changes to any form in the site. You can alter, remove
* or add form elements. You can also alter the validation and submission
* behavior. The name will always be modulename_form_alter.
*/
function form_alterations_form_alter(&$form, $form_state, $form_id) {
  // Normally a switch is used because you may want to alter more than
  // one form and it is easy to add a new case for each form.
  switch ($form_id) {
    // This is our form ID.
    case 'specialization_node_form':
    case 'version_node_form':
      // Adjust workflow form weight.
      if ($form['workflow']) {
        $form['workflow']['#weight'] = 28;
      }
      break;
  }
}

Mark W. Jarrell
Manager of Web Services
Jones Knowledge Integration Group, Inc.
http://fleetthought.com
http://www.jones.com
http://www.jonesdifference.com
http://www.jiu.edu
Twitter: attheshow


Thanks!

NonProfit's picture
NonProfit - Wed, 2009-05-13 18:54

Thanks, Mark. I'll check this out.