i need to override a form.html.twig in my custom module.
i used hook_theme_suggestions_alter in my .theme file to add new suggestions.
function MY_THEME_theme_suggestions_alter(array &$suggestions, array $variables){
if (isset($variables['element']) && isset($variables['element']['#type']) && $variables['element']['#type'] == 'form') {
$original_theme_hook = $variables['theme_hook_original'];
$suggestions[] = $original_theme_hook . '__' . str_replace('-', '_', $variables['element']['#id']);
}
return $suggestions;
}
the debug show me this suggestions
THEME HOOK: 'form' -->
<!-- FILE NAME SUGGESTIONS: * form--pom-mapping-setting-form.html.twig x form.html.twig -->
<!-- BEGIN OUTPUT from 'core/modules/system/templates/form.html.twig' -->
if i put form--pom-mapping-setting-form.html.twig in my_theme/templates/ folder works.
if i put form--pom-mapping-setting-form.html.twig in my_module/templates folder doesn't works
I don't understand why :/
why drupal doesn't read templates in module folder?
thanks