51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?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());
|
|
}
|
|
|
|
$relations[$category] = collect($relations[$category])->sortByDesc(function (Bundle $bundle) {
|
|
return $bundle->metadata()->get('date');
|
|
})->toArray();
|
|
}
|
|
|
|
data_set($this->viewData, 'relations', $relations);
|
|
|
|
return [$this->bundle->getPath() => $this->renderView('term')];
|
|
}
|
|
|
|
/**
|
|
* 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/';
|
|
}
|
|
|
|
protected function handlePagination(int $currentPage = 1)
|
|
{
|
|
}
|
|
|
|
protected function collectSubBundles()
|
|
{
|
|
return [];
|
|
}
|
|
}
|