Theme Suggestions

Created on 21 June 2024, 9 days ago

Problem/Motivation

The theme suggestions don't pick up the usual templates etc as the suggestions contain webform & entity id names
eg on a site I have products that use the pattern [entitytype]__[entitybundle]__[viewmode]
This is not in the template suggestions so it falls back to the field output as defined in the entity UI.
The suggestions offered by default are:

   ▪️ [entitytype]--[webform-name].html.twig
   ▪️ [entitytype]--[webform-name]--[entityid]--[viewmode].html.twig
   ▪️ [entitytype]--[webform-name]--[entityid].html.twig
   ▪️ [entitytype]--[webform-name]--[entitytype]--[viewmode].html.twig
   ▪️ [entitytype]--[webform-name]--[entitytype].html.twig
   ▪️ [entitytype]--[webform-name]--[entitytype]--[viewmode].html.twig
   ▪️ [entitytype].html.twig

Steps to reproduce

Create a template using the name convention [entitytype]--[entitybundle]--[viewmode].html.twig
Add a relevant entity to a webform using the viewmode of the template above
View on site - the template suggestion will not be used.

Proposed resolution

Unsure... can this module intervene in a suggestion alter to offer all the usual theme hooks? eg [entitytype]__[entitybundle] and [entitytype]__[entitybundle]__[viewmode]

I was able to make a custom alter hook to add the suggestions I need, but I don't know if this is a good general solution.

Many thanks for the module, this has made my editors lives much easier!

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇳🇿New Zealand AndyD328 Lyttelton, NZ 🇳🇿

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024