views:

27

answers:

3

Is there a way to customize a edit page form in Drupal depending on the menu link ? (or by passing additional parameters to the edit page url ?

i.e. I have a children "Add new product" item in both menu items "Catalog1" and "Catalog2".

I want to hide 2 different CCK fields in the product content type depending on which menu item has been clicked.

Or eventually can I pass parameters with the url ? and use these parameters in hook_form API to decide which CCK field to hide ?

Thanks

A: 

You probably want http://drupal.org/project/prepopulate.

Hiding the fields, however, is a different thing. You will need to create your own module that uses hook_form_alter to change the type of tields from text/input/select to hidden.

berkes
It's become a bit tricky in Prepopulate 2.0. You need to do everything in #after_build. See my more specific question here: http://stackoverflow.com/questions/3611381/how-do-i-hide-a-cck-nodereference-input-widget-in-after-build. See my blog post where I demonstrate non-hiding nodeform tweaks based on Prepopulate here: http://grayside.org/2010/09/node-form-dominos-node-reference-and-prepopulate
Grayside
A: 

You can try http://drupal.org/project/conditional_fields to hide the CCK fields too.

Sid NoParrots
A: 

I've actually solved by passing an additional php parameter from the menu item "Add Product" stating which catalog it should belong to.

Patrick

related questions