fix #15
This commit is contained in:
parent
1e91353c86
commit
fc267d80d1
5 changed files with 110 additions and 51 deletions
23
site/models/category.php
Normal file
23
site/models/category.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue