File tree Expand file tree Collapse file tree 5 files changed +470
-2
lines changed
Expand file tree Collapse file tree 5 files changed +470
-2
lines changed Original file line number Diff line number Diff line change 3636 }
3737
3838 $ i18ntag = $ section . ': ' . $ key ;
39-
4039 echo '<!-- ' . strtoupper ($ setting ['type ' ]) . ' ' . strtoupper ($ setting ['name ' ]) . ' --> ' ;
4140 echo '<div class="adminSettingCard relative flex flex-col rounded-xl p-3 shadow-xl bg-white ' . $ hidden . '" id=" ' . $ i18ntag . '"> ' ;
4241
6564 case 'checkbox ' :
6665 echo AdminInput::renderCheckbox ($ setting , $ i18ntag );
6766 break ;
67+ case 'toggle-button-group ' :
68+ echo AdminInput::renderToggleButtonGroup ($ setting , $ i18ntag );
69+ break ;
70+ case 'toggle-button-group-modal ' :
71+ echo AdminInput::renderToggleButtonGroupModal ($ setting , $ i18ntag );
72+ break ;
6873 case 'multi-select ' :
6974 case 'select ' :
7075 echo AdminInput::renderSelect ($ setting , $ i18ntag );
Original file line number Diff line number Diff line change 987987 ],
988988 'collage_layouts_enabled ' => [
989989 'view ' => 'advanced ' ,
990- 'type ' => 'multi-select ' ,
990+ 'type ' => 'toggle-button-group-modal ' ,
991991 'name ' => 'collage[layouts_enabled] ' ,
992+ 'button_label ' => 'choose_layouts ' ,
992993 'placeholder ' => $ defaultConfig ['collage ' ]['layouts_enabled ' ],
993994 'options ' => CollageLayoutEnum::cases (),
995+ 'preview_orientation ' => $ config ['collage ' ]['orientation ' ] ?? 'landscape ' ,
994996 'value ' => $ config ['collage ' ]['layouts_enabled ' ],
995997 ],
996998 'collage_orientation ' => [
Original file line number Diff line number Diff line change 3939 "choose_font" : " Choose a font" ,
4040 "choose_frame" : " Choose a frame" ,
4141 "choose_image" : " Choose an image" ,
42+ "choose_layouts" : " Choose layouts" ,
4243 "choose_placeholder" : " Choose a placeholder" ,
4344 "choose_video" : " Choose a video" ,
4445 "chroma_needs_background" : " Please choose a background first!" ,
4950 "click_element" : " Click" ,
5051 "close" : " Close" ,
5152 "collage" : " Collage" ,
53+ "collage_select_min_two_layouts" : " Choose at least two layouts to enable layout selection." ,
5254 "collage:collage_allow_selection" : " Allow layout selection" ,
5355 "collage:collage_background" : " Background" ,
5456 "collage:collage_background_color" : " Collage background color" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,25 @@ public static function getNode(): NodeDefinition
1212 {
1313 return (new TreeBuilder ('collage ' ))->getRootNode ()->addDefaultsIfNotSet ()
1414 ->ignoreExtraKeys ()
15+ ->validate ()
16+ ->always (function (array $ value ): array {
17+ $ layouts = $ value ['layouts_enabled ' ] ?? [];
18+ $ layouts = is_array ($ layouts ) ? $ layouts : [];
19+
20+ $ layoutValues = array_map (
21+ static fn ($ l ): string => $ l instanceof \BackedEnum ? (string ) $ l ->value : (string ) $ l ,
22+ $ layouts
23+ );
24+
25+ $ uniqueCount = count (array_unique ($ layoutValues ));
26+
27+ if (($ value ['allow_selection ' ] ?? false ) && $ uniqueCount < 2 ) {
28+ $ value ['allow_selection ' ] = false ;
29+ }
30+
31+ return $ value ;
32+ })
33+ ->end ()
1534 ->children ()
1635 ->booleanNode ('enabled ' )->defaultValue (true )->end ()
1736 ->integerNode ('cntdwn_time ' )
You can’t perform that action at this time.
0 commit comments