Skip to content

Instantly share code, notes, and snippets.

@mherchel
Last active January 5, 2019 15:25
Show Gist options
  • Save mherchel/42a8cff0e27620007bc918ece801b0df to your computer and use it in GitHub Desktop.
Save mherchel/42a8cff0e27620007bc918ece801b0df to your computer and use it in GitHub Desktop.
Strip extraneous divs from field templates
{% for item in items %}
{{ item.content }}
{% endfor %}
/**
* Implements hook_theme_suggestions_alter().
*/
function YOURTHEMENAME_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
if ($hook === 'field') {
switch ($field_name) {
case 'field_bio_media':
case 'field_media_image':
case 'field_hero_media':
case 'field_promo_media':
case 'field_episode_guests':
case 'field_show_hero_background_image':
$suggestions[] = 'field__bare';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment