Wie du hier siehst, erweitert das mod_newsarchive Template das block_unsearchable Template.
PHP-Code:
<?php $this->extend('block_unsearchable'); ?>
<?php $this->block('content'); ?>
<?php if (empty($this->articles)): ?>
<p class="empty"><?= $this->empty ?></p>
<?php else: ?>
<?= implode('', $this->articles) ?>
<?= $this->pagination ?>
<?php endif; ?>
<?php $this->endblock(); ?>
Das block_unsearchable Template sieht wiederum so aus:
PHP-Code:
<!-- indexer::stop -->
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>>
<?php endif; ?>
<?php $this->block('content'); ?>
<?php $this->endblock(); ?>
</div>
<!-- indexer::continue -->
Leider gibt es also für die Überschrift keinen eigenen Block (das kommt erst in Contao 4.2), daher kannst du aus dem mod_newsarchive Template auch nicht die Überschrift verändern, wenn du weiterhin das block_unsearchable Template erweiterst.
Die Lösung ist daher das block_unsearchable Template nicht zu erweitern, sondern den Inhalt von block_unsearchable und mod_newsarchive zusammen zu führen:
PHP-Code:
<!-- indexer::stop -->
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
<h1>My custom headline</h1>
<?php if (empty($this->articles)): ?>
<p class="empty"><?= $this->empty ?></p>
<?php else: ?>
<?= implode('', $this->articles) ?>
<?= $this->pagination ?>
<?php endif; ?>
</div>
<!-- indexer::continue -->
Siehe auch https://github.com/contao/core/issues/8165
Lesezeichen