From 1e2cee519264f9ab2660540723915aec72bc2116 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 20 Oct 2025 01:57:21 +0200 Subject: =?UTF-8?q?noeud=20"head"=20unique,=20noms=20fichiers=20CSS=20et?= =?UTF-8?q?=20JSS=20dans=20page,=20nombreux=20changements=20en=20cons?= =?UTF-8?q?=C3=A9quences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/Page.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/model/entities/Page.php') diff --git a/src/model/entities/Page.php b/src/model/entities/Page.php index 5b54ae6..3e90dbc 100644 --- a/src/model/entities/Page.php +++ b/src/model/entities/Page.php @@ -31,6 +31,23 @@ class Page #[ORM\Column(type: "text")] private string $description; + #[ORM\Column(type: "json", nullable: true)] + private ?array $css = null; + + #[ORM\Column(type: "json", nullable: true)] + private ?array $js = null; + + static private array $default_css = ['body', 'head', 'nav', 'foot']; + static private array $default_js = ['main']; + + /* remplissage + UPDATE nb_page + JOIN nb_node ON nb_node.page_id = nb_page.id_page + SET nb_page.css = JSON_EXTRACT(nb_node.attributes, '$.css_array'); + UPDATE nb_page + JOIN nb_node ON nb_node.page_id = nb_page.id_page + SET nb_page.js = JSON_EXTRACT(nb_node.attributes, '$.js_array'); */ + #[ORM\Column(type: "boolean")] private bool $reachable; @@ -103,6 +120,30 @@ class Page { $this->description = $description; } + public function getCSS(): array + { + return $this->css; + } + public function useDefaultCSS(): void + { + $this->css = self::$default_css; + } + public function setCSS(array $css): void + { + $this->css = $css; + } + public function getJS(): array + { + return $this->js; + } + public function useDefaultJS(): void + { + $this->js = self::$default_js; + } + public function setJS(array $js): void + { + $this->js = $js; + } public function isReachable(): bool { return $this->reachable; -- cgit v1.2.3