aboutsummaryrefslogtreecommitdiff
path: root/src/model/Blocks.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-08-26 01:15:33 +0200
committerpolo <ordipolo@gmx.fr>2025-08-26 01:15:33 +0200
commitf4df3e9b9df3d54ce58796f923da70ff7e566018 (patch)
treebbd037099976d0411533823b26a34949d04f286c /src/model/Blocks.php
parentb02b44d1da7e9ddd7a341d29a597accfbb78155c (diff)
downloadcms-f4df3e9b9df3d54ce58796f923da70ff7e566018.zip
séparation bloc / mise en page, bloc spécial pour les actus, renommage de classes, fichiers, etc
Diffstat (limited to 'src/model/Blocks.php')
-rw-r--r--src/model/Blocks.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/model/Blocks.php b/src/model/Blocks.php
new file mode 100644
index 0000000..f6475cd
--- /dev/null
+++ b/src/model/Blocks.php
@@ -0,0 +1,38 @@
1<?php
2// src/Blocks.php
3
4class Blocks{
5 /*private array $types = ['blog', 'grid', 'calendar', 'galery', 'form'];*/
6 static private array $types = ['post_block', 'news_block', 'calendar', 'galery', 'form'];
7
8 /*private array $names = ['Blog', 'Grille', 'Calendrier', 'Galerie', 'Formulaire'];*/
9 static private array $names = ['Articles libres', 'Actualités', 'Calendrier', 'Galerie', 'Formulaire'];
10
11 static public function getNameList(): array
12 {
13 $blocks = [];
14 foreach(self::$types as $type){
15 $blocks[] = $type;
16 }
17 return $blocks;
18 }
19
20 static public function getTypeNamePairs(): array
21 {
22 $blocks = [];
23 for($i = 0; $i < count(self::$types); $i++){
24 $blocks[] = ['type' => self::$types[$i], 'name' => self::$names[$i]];
25 }
26 return $blocks;
27 }
28
29 static public function getNameFromType(string $type): string
30 {
31 for($i=0; $i < count(self::$types); $i++){
32 if(self::$types[$i] === $type){
33 return self::$names[$i];
34 }
35 }
36 return 'server side error';
37 }
38} \ No newline at end of file