Skip to content

Instantly share code, notes, and snippets.

@WengerK
Last active July 18, 2018 12:35
Show Gist options
  • Save WengerK/104a41c62355bbb1e4162c816673f6fa to your computer and use it in GitHub Desktop.
Save WengerK/104a41c62355bbb1e4162c816673f6fa to your computer and use it in GitHub Desktop.
Article Ressources - Template Whisperer - Content-first templating in Drupal 8

Article Ressources - Template Whisperer - Content-first templating in Drupal 8

This is the Gist repository for my article Template Whisperer - Give more content confidence to your end-client.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

  • settings.php : Settings overriden manually to tweak the Flood Control
{% set suggestions = tw_suggestion_entities('projects_collection') %}
{% if suggestions %}
<a href="{{ path('entity.node.canonical', {'node': suggestions|first.id}) }}">see all my projects</a>
{% endif %}
$twManager = \Drupal::service('plugin.manager.template_whisperer');
$twSuggestionUsage = \Drupal::service('template_whisperer.suggestion.usage');
// Get entities from suggestion, if exists.
$suggestion = $twManager->getOneBySuggestion('projects_collection');
if(suggestion) {
$entities = $twSuggestionUsage->listUsage($suggestion);
}
* node--2--full.html.twig
* node--2.html.twig
* node--page--full.html.twig
* node--page.html.twig
* node--full.html.twig
* node.html.twig
* node--2--page--full--news-collection.html.twig
* node--page--full--news-collection.html.twig
* node--2--page--news-collection.html.twig
* node--page--news-collection.html.twig
* node--2--full.html.twig
* node--2.html.twig
* node--page--full.html.twig
* node--page.html.twig
* node--full.html.twig
* node.html.twig
<div class="mb-5">
{{ bamboo_render_block('game_filter_all_games_block') }}
</div>
{{ bamboo_render_block('game_all_games_block') }}
{% extends "@theme/content/node.html.twig" %}
{% block node_content_below %}
<section>
<div class="container">
{{ bamboo_render_block('mymodule_news_collection_block') }}
</div>
</section>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment