Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow themes to inherit module templates #1174
When developing themes it is common to want to make only minor cosmetic changes to the existing template, such as adding additional CSS. Under the old theming system it was possible to inherit the stock theme and alter it by simply include()ing the PHP.
Similar functionality doesn't exist in Twig, but arguably makes more sense here where we can now override a single block. This functionality is already used by themes to override the default theme, but the model doesn't extend to modules. Thus this commit introduces a special
E.g if I wanted to inheret the entire discopower module's template save for injecting one additional script into it, rather than copying the whole
That's a whole lot less maintenance for me as a theme developer when the module's template changes.
How is this different from the already existing functionality?
That's not quite the same thing - it is including content from within the same module and with a different name. That namespace, as you correctly point out, already exists as
To replicate the problem I am trying to solve with that example you would need to theme the admin module such that you had a file:
being a theme that replaces:
from your theme. In your theme, you then try and include the original
However, that doesn't work and creates a circular reference back to