In my custom theme, I have used the following code to provide suggestions for each form:
/**
* Implements hook_theme_suggestions_form_alter().
*/
function MYTHEME_theme_suggestions_form_alter(&$suggestions, &$vars) {
if ($vars['element']['#type'] === 'form') {
$suggestions[] = 'form__' . $vars['element']['#form_id'];
}
}
In a form--user-login-form.html.twig file I use the following code (simplified):
<form{{ attributes }}>
{{ element.name }}
{{ element.pass }}
{{ element.actions }}
{{ element|without('#children', 'name', 'pass', 'actions') }}
{{ element.form_build_id }}
{{ element.form_id }}
</form>
As you may notice, {{ children }} is not printed anywhere since I don't need it. Everything works fine with the form until I add Antibot into the game. In that case I can't submit the form any more.
Could anyone guess why?
Comments
Comment #2
vagelis-prokopiou commentedMy guess is that some validation prevents the form from submitting.
What I would do to debug:
1) Render all the elements of the form (including the children) and check if it submits.
2) Diff the form html generated without vs with the Antibot module, to try to identify differences, in order to concentrate there.
3) Diff the form requests without vs with the Antibot module.
4) Have a quick look for Antibot js form submit handlers, and go from there.
Comment #3
rcodinaYou have to add this:
{{ element.antibot_key }}I think this module should have a README file with a FAQ section.
Comment #4
gaurav.kapoor commentedClosing this issue as discussion can be taken up forward in https://www.drupal.org/project/antibot/issues/3247315.