How to reposition workflow fieldgroup in the edit form! Patch available here

edde42 - April 8, 2009 - 23:34
Project:Workflow
Version:6.x-1.1
Component:User interface
Category:task
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

I have a CCK form that has 3 fieldgroups and then a text area. The workflow fieldgroup is placed after the CCK fieldgroups and before the text area. It isn't listed in the Manage Fields so I can move it there...

#1

dman - April 22, 2009 - 02:46

as in http://drupal.org/node/441142

If you use CCK to 'manage fields' and drag the 'body' around anywhere (or make any change at all AFAIK) there's a good chance that the form 'weights' set when form_alter added its field will become totally nonsensical.

Here's my fix
workflow.module

<?php
/**
* Implementation of hook_content_extra_fields.
*
* Information for the positioning of non-CCK contrib fields
* @see content_extra_field_weight()
*
* Workflow inserts its widget into the node edit form low in the page, but cck
* then scrambles the node edit form when the 'body' is repositioned. Allow the
* CCK UI to fix that and place the widget where you want.
*/
function workflow_content_extra_fields($type_name) {
 
$extra = array();
  if (!
in_array('node', variable_get('workflow_' . $type_name, array('node')))) {
    return;
  }
 
$extra['workflow'] = array(
   
'label' => t('Workflow'),
   
'description' => t('The nodes workflow state'),
   
'weight' => 10,
  );
  return
$extra;
}
?>


I'm on stable, non dev/CVS system right now, so no patch.
If I was to roll a patch it would also add the option to collapse that fieldset by default, and optionally hide the date picker, which is redundant and confusing to my current editors.
Would that sort of patch be welcome?

If not, just paste this at the bottom of workflow.module.

AttachmentSize
content edit - after 63.3 KB
Node edit - before 30.9 KB

#2

dman - April 22, 2009 - 02:47
Status:active» needs review

#3

Benedict Steele - April 28, 2009 - 16:48

This works perfectly for me. I rolled it into a patch, just in case I needed to revert.

AttachmentSize
workflow-428376.patch 1.2 KB

#4

edde42 - April 28, 2009 - 18:09

Nice one dbman, worked perfect.

#5

dman - June 10, 2009 - 23:15
Status:needs review» reviewed & tested by the community

Patch is harmless, and useful - bumping this status up a bit.

#6

damon.cook - July 18, 2009 - 01:29

Awesome! I would really love the option to collapse the fieldset by default. Any timeline for patch?

Thanks so much!!!
Damon

#7

jhedstrom - July 23, 2009 - 18:41

Patch works as expected. Thanks dman.

#8

dboulet - July 28, 2009 - 16:22

This fix was just what I needed, thanks!

#9

dman - July 28, 2009 - 20:25
Category:support request» task

let's bump it up then. this is now a very well-tested patch!

#10

brisath - August 6, 2009 - 07:35

Subscribing.

I want this too, so I'm looking forward to this in a dev version.

#11

csc4 - September 15, 2009 - 21:59

Subscribing

#12

dman - September 15, 2009 - 23:51
Title:How to move workflow fieldgroup in the form?» How to reposition workflow fieldgroup in the edit form! Patch available here

jazzing up title

#13

ultrus - November 5, 2009 - 22:23

Yesssss! Headaches gone. Thank you! :D

 
 

Drupal is a registered trademark of Dries Buytaert.