Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293360

Add modules and themes as twig namespaces

$
0
0

Updated: Comment #N

Problem/Motivation

Twig has this concept of template include and extends. Currently we have to specify the complete path to a template file to include it. This fact, makes this feature of twig unusable for contrib module and themes.

Twig docs for namespaces

Proposed resolution

Add a twig namespace for each module and theme (somewhere in CoreServiceProvider::registerTwig).

Syntax in templates without namespaces.

  {% extends "core/themes/bartik/templates/node.html.twig" %}

Syntax in templates namespaces.

  {% extends "@bartik/node.html.twig" %}

Remaining tasks

Implementations, Tests, Docs

User interface changes

None.

API changes

None. We do not use include or extends in our templates atm.


Viewing all articles
Browse latest Browse all 293360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>