web-base/Core/Elements/TemplateView.class.php

41 lines
839 B
PHP
Raw Permalink Normal View History

2022-08-20 22:17:17 +02:00
<?php
2022-11-18 18:06:46 +01:00
namespace Core\Elements;
2022-08-20 22:17:17 +02:00
abstract class TemplateView extends View {
protected array $keywords = [];
protected string $description = "";
public function __construct(TemplateDocument $document) {
parent::__construct($document);
$this->title = "";
}
protected function getParameters(): array {
return [];
}
2024-05-04 16:40:37 +02:00
public function loadParameters(array &$parameters): void {
$this->loadView();
2022-08-20 22:17:17 +02:00
$siteParameters = [
"title" => $this->title,
"description" => $this->description,
"keywords" => $this->keywords
];
foreach ($siteParameters as $key => $value) {
if ($value) {
$parameters["site"][$key] = $value;
}
}
$parameters["view"] = $this->getParameters();
}
public function getCode(): string {
return $this->getDocument()->getCode();
}
}