hook_form for multiple content types defined by the same module
Posted
by pao13gate
on Stack Overflow
See other posts from Stack Overflow
or by pao13gate
Published on 2010-05-05T18:27:27Z
Indexed on
2010/05/06
2:28 UTC
Read the original article
Hit count: 208
drupal
A new module 'foo' implements foo_node_info() where one or more new content types can be defined.
If foo_node_info() defines two content types, namely a content type 'footypea' and a content type 'footypeb', how does one go about implementing hook_form() (what should the name of the "hook" be?) to configure each node's editing form?
In the drupal example, the name of the new content type is the same as the module name. What happens in the above described example where two new content types are defined by the module?
Should the implemented hook_form() function be of the form: footypea_form() and footypeb_form() ? (this doesn't seem to work)
Or should you implement a single foo_form() function and within this create and return an array $form with elements $form['footypea'] and $form['footypeb'] that are in turn arrays of the individual form field definitions?
© Stack Overflow or respective owner