[development] How to move taxonomy fields from the categoriesfieldset?

Angie Byron drupal-devel at webchick.net
Thu Jun 29 07:02:43 UTC 2006


> Depending on your needs, you might be able to get away with fewer 
> changes by doing this in your form_alter:
> 
> // Unset all but the #tree property, so that taxonomy is no longer a 
> fieldset.
> foreach (array_keys(element_properties($form['taxonomy'])) as $property) {
>  if ($property != '#tree'') {
>    unset($form['taxonomy'][$property]);
>  }
> } 

Nedjo, you are awesome! :D That little snippet was a life-saver today when 
trying to hide the forum selection field.

> It would be nice to be able to move the taxonomy element without setting 
> explicit weights, but e.g. array_splice() doesn't work with string keys. 

Jeff has a patch for this in the queue - http://drupal.org/node/66183 - 
although, I couldn't get it to work as advertised. I might try Frankensteining 
yours and his together and see what I come up with because I agree it would be 
useful.

Thanks so much, again! Handbook page will be forthcoming; hopefully I can get 
some good examples done tomorrow. :)

-Angie



More information about the development mailing list