mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-26 01:23:49 +00:00
Render for generic doc
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\DocStoreBundle\GenericDoc\Renderer;
|
||||
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocDTO;
|
||||
use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\Providers\AccompanyingProviderCourseDocumentGenericDoc;
|
||||
use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository;
|
||||
|
||||
final readonly class AccompanyingCourseDocumentGenericDocRenderer implements GenericDocRendererInterface
|
||||
{
|
||||
public function __construct(
|
||||
private AccompanyingCourseDocumentRepository $accompanyingCourseDocumentRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
||||
{
|
||||
return $genericDocDTO->key === AccompanyingProviderCourseDocumentGenericDoc::KEY;
|
||||
}
|
||||
|
||||
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
|
||||
{
|
||||
return '@ChillDocStore/List/list_item.html.twig';
|
||||
}
|
||||
|
||||
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
|
||||
{
|
||||
return [
|
||||
'document' => $this->accompanyingCourseDocumentRepository->find($genericDocDTO->identifiers['id']),
|
||||
'accompanyingCourse' => $genericDocDTO->linked,
|
||||
'options' => $options,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user