Zdefiniować widok Books i stronę w widoku

Szablon widoku
views-view--books--page-1.html.twigdodać na początku
{% set classes = ['view', 'view-' ~ (id|clean_class), 'view-id-' ~ id, 'view-display-id-' ~ display_id, dom_id ? 'js-view-dom-id-' ~ dom_id] %}
<div {{ attributes.addClass(classes) }}>
<header>
{# Odczyt pola kategorii i zamiana na string #}
{% set category_elements = [] %}
{% for item in node.field_category %}
{% set category_elements = category_elements|merge([item.entity.label]) %}
{% endfor %}
{% set categories = category_elements|join(', ') %}
{{ include('dafr_mercury:site-banner', {
title: view.getTitle() ? view.getTitle() : title,
margin_bottom: 24,
padding_top: 4,
padding_bottom: 8
}, with_context = false) }}
</header>
<div class="container mx-auto px-4 flex gap-8">
{{ title_prefix }}
...W szablonie strony book
node--book-page.html.twig
{% set depth = node.book.depth %}
<article{{ attributes.addClass(classes) }} data-aos="fade-in" data-aos-duration="500" >
<header>
{# Odczyt pola kategorii i zamiana na string #}
{% set category_elements = [] %}
{% for item in node.field_category %}
{% set category_elements = category_elements|merge([item.entity.label]) %}
{% endfor %}
{% set categories = category_elements|join(', ') %}
{{ include('dafr_mercury:site-banner', {
title: label,
site_www: node.field_website.value,
description: content.field_description,
category: categories|raw,
margin_bottom: 12,
padding_top: 4,
padding_bottom: 8
}, with_context = false) }}
</header>
{% if depth > 1 %}
<div{{ content_attributes.addClass('container mx-auto px-4 flex flex-wrap gap-4 ') }}>
<div class="node-content flex-1">
<div class="flex flex-wrap w-full gap-4 mb-8">
<nav class="w-full md:max-w-[300px] pt-2" role="navigation" aria-label="{{ 'Book navigation'|t }}">
{{content.links}}
</nav>
{% if node.field_attachments is not empty %}
<div class="w-full md:flex-1 p-4 bg-dark text-slate-200 border-b border-gray-800">
<h4 class="text-lg">Pliki:</h4>
{{ content.field_attachments }}
</div>
{% endif %}
</div>
{{ content.field_content }}
</div>
<div class="right-col">
<div class="bg-dark p-4 w-[250px]" data-aos="fade-left" data-aos-duration="1000" data-aos-delay="300">
<h4 class="text-lg mb-4 block">Spis treści:</h4>
{{ include('dafr_mercury:toc', {
show: true,
heading: 'Na tej stronie:'|t,
heading_level: 2,
content_selector: '.node-content',
heading_levels: 'h2, h3',
sticky: true
}, with_context = false) }}
</div>
</div>
</div>
{% else %}
<div{{ content_attributes.addClass('container mx-auto px-4 flex flex-wrap gap-4 ') }}>
<div class="flex flex-wrap w-full gap-4 mb-8">
<nav class="w-full md:max-w-[300px] pt-2" role="navigation" aria-label="{{ 'Book navigation'|t }}">
{{content.links}}
</nav>
{% if node.field_book_description is not empty %}
<div class="w-full md:flex-1 p-4 bg-dark text-slate-200 border-b border-gray-800">
<h4 class="text-lg">Opis:</h4>
{{ content.field_book_description }}
</div>
{% endif %}
</div>
{# Widok kart książek #}
<div class="w-full">
{{ drupal_view('books', 'block_1') }}
</div>
</div>
{% endif %}
</article>