- πΊπΈUnited States bluegeek9
The Message templates are not the same as twig templates. You need to create a Message template in the UI.
Automatically closed - issue fixed for 2 weeks with no activity.
I have Drupal 8 with the Message module.
I created message templates using drupal 8 but I prefer to use TWIG.
In Drupal 8 my code works, but when I put it in TWIG, the tokens do not work.
How to use the Message Template ?
{#
/**
* @file
* Default theme implementation for message entities.
*
* Available variables:
* - $content: An array of comment items. Use render($content) to print them all, or
* print a subset such as render($content['field_example']). Use
* hide($content['field_example']) to temporarily suppress the printing of a
* given element.
* - $title: The (sanitized) entity label.
* - $url: Direct url of the current entity if specified.
* - $page: Flag for the full page state.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. By default the following classes are available, where
* the parts enclosed by {} are replaced by the appropriate values:
* - entity-{ENTITY_TYPE}
* - {ENTITY_TYPE}-{BUNDLE}
*
* Other variables:
* - $classes_array: Array of html class attribute values. It is flattened
* into a string within the variable $classes.
*
* @see template_preprocess()
* @see template_preprocess_message()
* @see template_process()
*/
#}
<div{{ attributes }}>
<div class="timeline">
<div class="timeline-icon">
<a href="[message:author:url]" title="[message:author:display-name]">
<img src="[message:author:user_picture:thumbnail]" alt="[message:author:user_picture:alt]">
</a>
</div>
<div class="timeline-content mb-3">
<div class="card">
<div class="card-header text-center">
Nouvelle boutique
</div>
<div class="card-body">
<div class="card-text">
<h6>par <a href="[message:author:url]" title="[message:author:display-name]">[message:author:display-name]</a>, il y a [message:created:since]</h6>
</div>
</div>
<div class="card-img-top">
<a href="[message:field_store_reference:entity:url]" title="[message:field_store_reference:entity:name]">
<img src="[message:field_store_reference:entity:field_personnel_logo:diaporama_lg_50][message:field_store_reference:entity:field_professionnel_logo:diaporama_lg_50]" alt="[message:field_store_reference:entity:field_personnel_logo:alt][message:field_store_reference:entity:field_professionnel_logo:alt]" typeof="Image" class="img-responsive">
</a>
</div>
<div class="card-body">
<h3 class="card-title mb-0">
<a href='[message:field_store_reference:entity:url]'>[message:field_store_reference:entity:name]</a>
</h3>
</div>
<div class="card-footer text-center">
<small class="text-muted"></small>
<a class="timeline-link" href='[message:field_store_reference:entity:url]'>
Voir la boutique test
</a>
</small>
</div>
</div>
</div>
</div>
{{ content }}
</div>
[![enter image description here][1]][1]
Fixed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
The Message templates are not the same as twig templates. You need to create a Message template in the UI.
Automatically closed - issue fixed for 2 weeks with no activity.