Drupal utilizes theme hook suggestions for ways to allow output variations based on different conditions. It allows site themes to provide a more specific template for certain instances.
When a theme hook has double underscores (__), Drupal's theme system understands this, and it can break apart the theme hook to find a more generic template. For instance, the email element definition provides input__email as its theme hook. Drupal understands this as follows:
- Look for a Twig template named input--email.html.twig or a theme hook that defines input__email
- If you are not satisfied, look for a Twig template named input.html.twig or a theme hook that defines the input
Theme hook suggestions can be provided by the hook_theme_suggestions() hook in a .module or .theme file.