Last active
October 14, 2021 05:30
-
-
Save steffenr/5011792 to your computer and use it in GitHub Desktop.
Sample used in our second blog post on theming with Twig in Drupal 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for book_id, menu in book_menus %} | |
<nav id="book-block-menu-{{ book_id }}" class="book-block-menu"> | |
{{ menu }} | |
</nav> | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php foreach ($book_menus as $book_id => $menu): ?> | |
<div id="book-block-menu-<?php print $book_id; ?>" class="book-block-menu"> | |
<?php print render($menu); ?> | |
</div> | |
<?php endforeach; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo check_plain($title); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ title|escape }} | |
{{ title|e('js') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Hier steht ein einzeiliger Kommentar #} | |
{# Hier steht ein mehrzeiliger Kommentar | |
mit weiteren Informationen zur Funktionsweise des Templates. | |
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hier steht ein einzeiliger Kommentar. | |
/* | |
* Hier steht ein mehrzeiliger Kommentar | |
* mit weiteren Informationen zur Funktionsweise des Templates. | |
*/ | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<figure class="{{ item.attributes.class }}"{{ item.attributes }}> | |
{% if style %} | |
{% include 'core/themes/stark/templates/image/image_style.html.twig' with {image: item.image } %} | |
{% else %} | |
{% include 'core/themes/stark/templates/theme.inc/image.html.twig' with {image: item.image } %} | |
{% endif %} | |
{% if item.caption %} | |
<figcaption> | |
{{ item.caption }} | |
</figcaption> | |
{% endif %} | |
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ name }} <small>{{ '(Machine name: @type)'|t({ '@type': type }) }}</small> | |
<div class="description">{{ description }}</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="poll"> | |
<div class="title"><?php print $title ?></div> | |
<?php print $results ?> | |
<div class="total"> | |
<?php print t('Total votes: @votes', array('@votes' => $votes)); ?> | |
</div> | |
</div> | |
<div class="links"><?php print $links; ?></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="custom-wrapper"> | |
<label for="<?php print $widgets['filter-myfield']->id; ?>"> | |
<?php print $widgets['filter-myfield']->label ?> | |
</label> | |
<?php print $widgets['filter-myfield']->widget ?> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="custom-wrapper"> | |
<label for="{{ widgets.filter-myfield.id }}">{{ widgets.filter-myfield.label }}</label> | |
{{ widgets.filter-myfield.widget }} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="taxonomy-term-{{ term.tid }}"{{ attributes }}> | |
{% if not page %} | |
<h2>{{ term_name }}</h2> | |
{% endif %} | |
<div class="content"> | |
{{ content }} | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="taxonomy-term-<?php print $term->tid; ?>"> | |
<?php if (!$page): ?> | |
<h2><?php print $term_name; ?></h2> | |
<?php endif; ?> | |
<div class="content"> | |
<?php print render($content); ?> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment