diff options
Diffstat (limited to 'src/model/Blocks.php')
| -rw-r--r-- | src/model/Blocks.php | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/src/model/Blocks.php b/src/model/Blocks.php index a6fab45..53268db 100644 --- a/src/model/Blocks.php +++ b/src/model/Blocks.php | |||
| @@ -1,38 +1,7 @@ | |||
| 1 | <?php | 1 | <?php |
| 2 | // src/Blocks.php | 2 | // src/model/Blocks.php |
| 3 | 3 | ||
| 4 | class Blocks{ | 4 | class Blocks{ |
| 5 | /*private array $types = ['blog', 'grid', 'calendar', 'galery', 'form'];*/ | 5 | static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', 'galery' => 'Galerie', 'calendar' => 'Calendrier', 'form' => 'Formulaire']; |
| 6 | static private array $types = ['post_block', 'news_block', 'galery', 'calendar', 'form']; | 6 | static public array $presentations = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque', 'carousel' => 'Carrousel']; |
| 7 | |||
| 8 | /*private array $names = ['Blog', 'Grille', 'Calendrier', 'Galerie', 'Formulaire'];*/ | ||
| 9 | static private array $names = ['Articles libres', 'Actualités', 'Galerie', 'Calendrier', '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 | 7 | } \ No newline at end of file |
