Is there a convention for the form IDs?
I see that core sometimes uses module_name.form_name and sometimes module_name_form_name.
In my case, I'm using module_name.form_name.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Drupal core doesn't use the dot in the form IDs because, as the documentation for
FormInterface::getFormId() says, the form ID should be a unique string that can be a valid PHP function name, since it's used in hook implementation names such as
The form IDs Drupal core uses follow the
<module name>_<form name> schema, so you will find form IDs like the following.
As long as the form ID is unique, any scheme would work. The convention to prefix an ID with the module name (i.e. the module machine name) has been used from Drupal since many years.