ajout de la methode allTexts() dans site\models\year.php

This commit is contained in:
antonin gallon 2026-02-09 20:57:56 +01:00
parent 344af4c0fe
commit dee8f94182
2 changed files with 10 additions and 1 deletions

8
site/models/year.php Normal file
View file

@ -0,0 +1,8 @@
<?php
class YearPage extends Page{
public function allTexts(){
$texts = $this->children()->listed();
$linked = $this->linkedTexts()->toPages();
return $texts->merge($linked);
}
}

View file

@ -18,7 +18,8 @@
class="see-more toggle-btn toggle-btn--left" @click="edito = !edito">Lire</button>
<?php endif ?>
<ul class="panel-item-content__texts texts">
<?php foreach($section->children() as $article): ?>
<?php $articles = method_exists($section, 'allTexts') ? $section->allTexts() : $section->children(); ?>
<?php foreach($articles as $article): ?>
<?php
$author = $article->author()->toPage() == null ? 'inconnu' : $article->author()->toPage()->title();
?>