Misc hooks

Last updated on
14 October 2016

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.