By jrockowitz on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x-5.x
Introduced in version:
8.x-5.0-rc3
Issue links:
Description:
Previously, the webform submission form id included the source entity type and id in the form ID which required modules to create hook_form_FORM_ID_alter() hooks like...
hook_form_{BASE_FORM_ID}_{WEBFORM_ID}_{ENTITY_TYPE}_{ENTITY_ID}_{OPERATION}_form_alter()
For example, if the Contact webform was attached to a Webform Node the hook_form_FORM_ID_alter() would be...
/**
* Implements hook_form_FORM_ID_alter().
*/
function CUSTOM_MODULE_form_webform_submission_form_contact_node_12345_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state){
...
}
Now, modules should target just the webform id and operation when using hook_form_FORM_ID_alter().
hook_form_{BASE_FORM_ID}_{WEBFORM_ID}_{OPERATION}_form_alter()
For example, to alter the Contact webform the hook is now...
/**
* Implements hook_form_FORM_ID_alter().
*/
function CUSTOM_MODULE_form_webform_submission_contact_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
...
}
Impacts:
Module developers
Themers