Skip to content

Instantly share code, notes, and snippets.

View jenlampton's full-sized avatar

Jen Lampton jenlampton

View GitHub Profile

This is a proposal for the new Drupal 8 theme system. It consists of 5 Phases.

Example for terminology: For the following explanation and all examples, let's say we are working with a node of type Article.

  • hook = the name of the module or theme that is inplementing the hook (examples at bottom)
  • THEME_ID = name of the theme hook. for the node template his will be node.
  • SUGGESTION_ID = name of the template suggestion. for the node template, this will be article.

1) Definition

@jenlampton
jenlampton / gist:5650953
Last active December 17, 2015 18:09
New comment template (and variables) for Twig in D8
<article{{ attributes }}>
{{ title.prefix }}
{% if new %}
<mark class="new">{{ new }}</mark>
{% endif %}
<h3{{ title.attributes }}>{{ title.label }}</h3>
{{ title.suffix }}
<footer>
@jenlampton
jenlampton / gist:5647420
Last active December 17, 2015 17:39
New node template (and variables) for Twig in D8
<article id="node-{{ nid }}" class="clearfix {{ attributes.class }}"{{ attributes }}>
{{ title.prefix }}
{% if not page %}
<h2{{ title.attributes }}><a href="{{ url }}" rel="bookmark">{{ title.label }}</a></h2>
{% endif %}
{{ title.suffix }}
{% if display_submitted %}
<footer>