Misc hooks
Last updated on
14 October 2016
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
If your module implements an entity form with the help of entity_ui_get_form()
, the following template helps you documenting the according hook_form_alter(). Note, that if your entity type has no bundles (or isn't fieldable), you need to remove the sentence concerning bundles.
/**
* Alter {ENTITY} forms.
*
* Modules may alter the {ENTITY} entity form by making use of this hook or
* the entity bundle specific hook_form_{ENTITY_ID}_edit_BUNDLE_form_alter().
* #entity_builders may be used in order to copy the values of added form
* elements to the entity, just as documented for
* entity_form_submit_build_entity().
*
* @param $form
* Nested array of form elements that comprise the form.
* @param $form_state
* A keyed array containing the current state of the form.
*/
function hook_form_{ENTITY_ID}_form_alter(&$form, &$form_state) {
// Your alterations.
}
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion