twig et css /node-site block third projet lié

This commit is contained in:
2025-11-12 12:32:20 +01:00
parent cd8e0b5154
commit 86ce675e66
5 changed files with 85 additions and 74 deletions

View File

@@ -62,65 +62,45 @@
* @ingroup themeable
*/
#}
{# <article{{ attributes }}>
<article{{ attributes }}>
{{ title_prefix }}
{% if label and not page %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{{ title_prefix }}
{% if label and not page %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{% if display_submitted %}
<footer>
{{ author_picture }}
<div{{ author_attributes }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div{{ content_attributes }}>
{{ content }}
</div>
{% if display_submitted %}
<footer>
{{ author_picture }}
<div{{ author_attributes }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
</article> #}
<div{{ content_attributes }}>
{% set node_title = node.label %}
{% set node_url = (url is defined and url) ? url : path('entity.node.canonical', {'node': node.id}) %}
{% if node_title %}
{{ title_prefix }}
<h3{{ title_attributes }} class="node-projet-title">
<a href="{{ node_url }}" rel="bookmark">{{ node_title }}</a>
</h3>
{{ title_suffix }}
{% endif %}
{{ content }}
</div>
</article>
{# node--projets-lies.html.twig #}
{# On détecte si le node est lauréat via le champ field_laureats #}
{% set is_laureat = content.field_laureats is defined
and content.field_laureats['#items'] is defined
and content.field_laureats['#items']|length > 0
%}
<article{{ attributes.addClass('node-type-projet', is_laureat ? 'is-laureat' : '') }}>
{{ title_prefix }}
{% if label and not page %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{% if display_submitted %}
<footer>
{{ author_picture }}
<div{{ author_attributes }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div{{ content_attributes }}>
{{ content }}
</div>
</article>

View File

@@ -1,4 +1,4 @@
{# views-view-fields--sites_projets--page_1.html.twig (or your variant) #}
{% import _self as m %}