If I form alter a form, I see the form_id as MY_FORM_ID
; I see this in the $form_id
parameter to hook_form_alter
as well as in the $form_state->build_info['form_id']
. In the rendered output of the form, however, I see the id attribute has something like MY-FORM-ID--2
, with a --INT
modifier. If I output the same form twice on a page, while logged in the modifier is changed with each render (e.g. MY-FORM-ID--2
and MY-FORM-ID--4
), however the modifier is not changed when viewing as anon. This creates an instance where two elements have the same id attribute which is no good! :(
- Where does core add the modifier?
- How can I add a modifier?