diff options
author | polo <ordipolo@gmx.fr> | 2025-09-29 20:56:49 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2025-09-29 20:56:49 +0200 |
commit | 9bf2b97a9b5d9ea1f627545733d993c1731533ce (patch) | |
tree | 846f41b23210deeb4bd446a1a96ba51288a97dae | |
parent | 23fe455ead832c97fdabafca78393e21a18086bf (diff) | |
download | cms-9bf2b97a9b5d9ea1f627545733d993c1731533ce.zip |
bug manque d'une présentation par défaut
-rw-r--r-- | src/model/Blocks.php | 6 | ||||
-rw-r--r-- | src/view/MainBuilder.php | 5 | ||||
-rw-r--r-- | src/view/templates/modify_block.php | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/model/Blocks.php b/src/model/Blocks.php index 21e3c18..786ec74 100644 --- a/src/model/Blocks.php +++ b/src/model/Blocks.php | |||
@@ -5,7 +5,13 @@ class Blocks{ | |||
5 | static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', | 5 | static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', |
6 | //'galery' => 'Galerie', | 6 | //'galery' => 'Galerie', |
7 | 'calendar' => 'Calendrier', 'form' => 'Formulaire']; | 7 | 'calendar' => 'Calendrier', 'form' => 'Formulaire']; |
8 | |||
8 | static public array $presentations = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque' | 9 | static public array $presentations = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque' |
9 | //, 'carousel' => 'Carrousel' | 10 | //, 'carousel' => 'Carrousel' |
10 | ]; | 11 | ]; |
12 | |||
13 | static public function hasPresentation(string $block): bool | ||
14 | { | ||
15 | return in_array($block, ['post_block', 'news_block']) ? true : false; | ||
16 | } | ||
11 | } \ No newline at end of file | 17 | } \ No newline at end of file |
diff --git a/src/view/MainBuilder.php b/src/view/MainBuilder.php index e4f91f3..a04130a 100644 --- a/src/view/MainBuilder.php +++ b/src/view/MainBuilder.php | |||
@@ -75,6 +75,11 @@ class MainBuilder extends AbstractBuilder | |||
75 | if($child_node->getName() === 'news_block'){ | 75 | if($child_node->getName() === 'news_block'){ |
76 | $order = $child_node->getNodeData()->getChronoOrder() ? 'chrono' : 'antichrono'; | 76 | $order = $child_node->getNodeData()->getChronoOrder() ? 'chrono' : 'antichrono'; |
77 | } | 77 | } |
78 | |||
79 | // présentation par défaut | ||
80 | if(Blocks::hasPresentation($child_node->getName()) && $child_node->getNodeData()->getPresentation() === null){ | ||
81 | $child_node->getNodeData()->setPresentation('full_width'); // pas de persistence ici | ||
82 | } | ||
78 | 83 | ||
79 | ob_start(); | 84 | ob_start(); |
80 | require self::VIEWS_PATH . 'modify_block.php'; | 85 | require self::VIEWS_PATH . 'modify_block.php'; |
diff --git a/src/view/templates/modify_block.php b/src/view/templates/modify_block.php index b44327f..1d097e0 100644 --- a/src/view/templates/modify_block.php +++ b/src/view/templates/modify_block.php | |||
@@ -30,7 +30,7 @@ if($child_node->getName() === 'news_block'){ | |||
30 | </div> | 30 | </div> |
31 | <?php | 31 | <?php |
32 | } | 32 | } |
33 | if($child_node->getNodeData()->getPresentation() !== null){ | 33 | if(Blocks::hasPresentation($child_node->getName())){ |
34 | ?> | 34 | ?> |
35 | <div class="grid_options"> | 35 | <div class="grid_options"> |
36 | <div> | 36 | <div> |