23 lines
479 B
PHP
23 lines
479 B
PHP
<?php
|
|
|
|
use Kirby\Cms\Pages;
|
|
use Kirby\Cms\Page;
|
|
use Kirby\Uuid\Uuid;
|
|
|
|
class CategoryPage extends Page
|
|
{
|
|
public function children(): Pages
|
|
{
|
|
$category = $this->title()->value();
|
|
$allTexts = page("textes")->grandChildren();
|
|
$textsInCategory = $allTexts->filterBy('category', $category);
|
|
|
|
$children = new Pages();
|
|
|
|
foreach ($textsInCategory as $text) {
|
|
$children->add($text);
|
|
}
|
|
|
|
return $children;
|
|
}
|
|
}
|