1
0
cms11/app/Services/BundleRenderers/Renderers/TermRenderer.php

51 lines
1.3 KiB
PHP
Raw Normal View History

2024-04-26 13:47:36 +02:00
<?php
namespace App\Services\BundleRenderers\Renderers;
use App\Classes\Bundle;
class TermRenderer extends BaseRenderer
{
/**
* Renders a complete HTML view of the bundle
*/
public function render()
{
$this->prepareRender();
$relations = [];
foreach ($this->bundle->metadata('relations')->all() as $category => $bundles) {
foreach ($bundles as $path) {
$relations[$category][] = new Bundle($path, $this->bundle->getDisk());
}
2024-04-26 20:37:55 +02:00
$relations[$category] = collect($relations[$category])->sortByDesc(function (Bundle $bundle) {
return $bundle->metadata()->get('date');
})->toArray();
2024-04-26 13:47:36 +02:00
}
data_set($this->viewData, 'relations', $relations);
2024-05-11 01:18:21 +02:00
return [$this->bundle->getPath() => $this->renderPage('term')];
2024-04-26 13:47:36 +02:00
}
/**
* Return a boolean value indicating if this creator in particular can
* create bundles for specified section
*/
public static function handles(Bundle $bundle): bool
{
return $bundle->getSection() && $bundle->getSection()->getPath() === '/termes/';
}
2024-04-26 16:09:33 +02:00
protected function handlePagination(int $currentPage = 1)
2024-04-26 13:47:36 +02:00
{
}
2024-04-26 16:09:33 +02:00
protected function collectSubBundles()
{
return [];
}
2024-04-26 13:47:36 +02:00
}