11<?php
22require_once MAXI_PLUGIN_DIR_PATH . 'core/utils/get-last-breakpoint-attribute.php ' ;
3- include MAXI_PLUGIN_DIR_PATH . 'core/defaults/sc_defaults.php ' ;
3+ require_once MAXI_PLUGIN_DIR_PATH . 'core/defaults/sc_defaults.php ' ;
44
55
66class MaxiBlocks_StyleCards
@@ -47,6 +47,11 @@ public function enqueue_styles()
4747
4848 $ styles = $ this ->get_style_card_styles ();
4949
50+ // MVP: ensure no margin-bottom for button
51+ if (str_contains ($ styles , 'margin-bottom: var(--maxi-light-button-margin-bottom-general); ' )) {
52+ $ styles = str_replace ('margin-bottom: var(--maxi-light-button-margin-bottom-general); ' , '' , $ styles );
53+ }
54+
5055 // SC styles
5156 if ($ styles ) {
5257 wp_register_style ('maxi-blocks-sc-styles ' , false );
@@ -78,7 +83,7 @@ public function get_style_card_variables()
7883 $ style_card = $ this ->get_style_card_object_from_db ();
7984
8085 if (!$ style_card ) {
81- if ($ GLOBALS ['default_sc_variables_string ' ]) {
86+ if (isset ( $ GLOBALS ['default_sc_variables_string ' ]) ) {
8287 return $ GLOBALS ['default_sc_variables_string ' ];
8388 }
8489
@@ -103,7 +108,7 @@ public function get_style_card_variables()
103108 }
104109
105110 if (!$ style || empty ($ style ) || $ style === ':root{--maxi-active-sc-color:0,0,0;} ' ) { // ':root{--maxi-active-sc-color:0,0,0;}' is the default value
106- if ($ GLOBALS ['default_sc_variables_string ' ]) {
111+ if (isset ( $ GLOBALS ['default_sc_variables_string ' ]) ) {
107112 return $ GLOBALS ['default_sc_variables_string ' ];
108113 }
109114
@@ -118,7 +123,7 @@ public function get_style_card_styles()
118123 $ style_card = $ this ->get_style_card_object_from_db ();
119124
120125 if (!$ style_card ) {
121- if ($ GLOBALS ['default_sc_styles_string ' ]) {
126+ if (isset ( $ GLOBALS ['default_sc_styles_string ' ]) ) {
122127 return $ GLOBALS ['default_sc_styles_string ' ];
123128 }
124129
@@ -137,7 +142,7 @@ public function get_style_card_styles()
137142 !array_key_exists ('_maxi_blocks_style_card_styles ' , $ style_card ) &&
138143 !array_key_exists ('_maxi_blocks_style_card_styles_preview ' , $ style_card )
139144 ) {
140- if ($ GLOBALS ['default_sc_styles_string ' ]) {
145+ if (isset ( $ GLOBALS ['default_sc_styles_string ' ]) ) {
141146 return $ GLOBALS ['default_sc_styles_string ' ];
142147 }
143148
@@ -157,7 +162,7 @@ public function get_style_card_styles()
157162 }
158163
159164 if (!$ sc_variables || empty ($ sc_variables )) {
160- if ($ GLOBALS ['default_sc_styles_string ' ]) {
165+ if (isset ( $ GLOBALS ['default_sc_styles_string ' ]) ) {
161166 return $ GLOBALS ['default_sc_styles_string ' ];
162167 }
163168
@@ -239,7 +244,7 @@ public static function get_maxi_blocks_style_card_fonts($block_style, $text_leve
239244 * Button case has an exception for font-family. If it's empty, it will use the
240245 * font-family of the paragraph text level.
241246 */
242- if ($ text_level === 'button ' && empty ($ font )) {
247+ if ($ text_level === 'button ' && ( empty ($ font) || empty ( str_replace ( ' " ' , '' , $ font )) || str_contains ( $ font , ' undefined ' ) )) {
243248 $ font = $ style_card_values ->p ['font-family-general ' ];
244249 }
245250
0 commit comments