* Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license.
9
*
10
* Change Date: TBD ( 3 years after 2.2.0 release )
11
*
12
* On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file.
13
*/
14
15
namespace Parthenon\Athena\ViewType;
16
17
use Parthenon\Athena\Entity\CrudEntityInterface;
18
use Parthenon\Athena\SectionManagerInterface;
19
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
20
21
class EntityViewType implements ViewTypeInterface
22
{
23
private mixed $data;
24
25
public function __construct(
26
private UrlGeneratorInterface $urlGenerator,
27
private SectionManagerInterface $sectionManager,
28
) {
29
}
30
31
public function getName(): string
32
{
33
return 'entity';
34
}
35
36
public function setData($data)
37
{
38
$this->data = $data;
39
}
40
41
public function getHtmlOutput(): string
42
{
43
if (!$this->data instanceof CrudEntityInterface) {
44
throw new \InvalidArgumentException('Invalid entity');