You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
Copy file name to clipboardexpand all lines: docs/features/pattern-lab.md
+6
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,12 @@ From your Drupal Twig templates in `templates/` you can `{% include %}`, `{% ext
22
22
23
23
For a demonstration in a sample codebase of how exactly to integrate templates, see the [`drupal-lab`](https://github.com/phase2/drupal-lab) repo; in particular note how both a [node teaser template](https://github.com/phase2/drupal-lab/blob/master/web/themes/dashing/templates/content/node--article--teaser.html.twig) and a [views field template](https://github.com/phase2/drupal-lab/blob/master/web/themes/dashing/templates/views/views-view-fields--newspage--page.html.twig) in the Drupal `templates/` folder can embed the [card template](https://github.com/phase2/drupal-lab/blob/master/web/themes/dashing/pattern-lab/source/_patterns/02-molecules/cards/card.twig) from Pattern Lab while formatting the data.
24
24
25
+
### A word on twig template inheritance
26
+
27
+
-`include`: Dump the contents of that template into this one.
28
+
-`extends`: Take the old template and allow me to override blocks defined in the other template - I don't get to redefine everything and I don't get to define new blocks - I just get to suppress the old block definition and redefine it (and then I can dump the parent template's block definition into my definition if I use` {{ parent() }}` – kinda like doing an include just of that one block from the parent template's definition into your child template definition
29
+
-`embed`: Include but then override blocks from that include (super useful for layouts).
0 commit comments