| @@ -6,8 +6,9 @@ | ||
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | use ABlocks\Classes\BlockBaseAbstract; |
| 9 | 9 | use ABlocks\Classes\CssGenerator; |
| 10 | +use ABlocks\Classes\CssGeneratorV2; | |
| 10 | 11 | use ABlocks\Controls\Alignment; |
| 11 | 12 | use ABlocks\Controls\Typography; |
| 12 | 13 | use ABlocks\Controls\TextShadow; |
| 13 | 14 | use ABlocks\Controls\TextStroke; |
| @@ -14,32 +15,29 @@ | ||
| 14 | 15 | use ABlocks\Controls\Border; |
| 15 | 16 | use ABlocks\Controls\Dimensions; |
| 16 | 17 | use ABlocks\Controls\Icon; |
| 17 | 18 | use ABlocks\Controls\Range; |
| 19 | +use ABlocks\Controls\Color; | |
| 18 | 20 | |
| 19 | 21 | class Block extends BlockBaseAbstract { |
| 20 | 22 | protected $block_name = 'info-box'; |
| 21 | 23 | |
| 22 | - public function build_css( $attributes ) { | |
| 24 | + public function build_css_v1( $attributes ) { | |
| 23 | 25 | $css_generator = new CssGenerator( $attributes, $this->block_name ); |
| 24 | - $css_generator->add_class_styles( | |
| 25 | - '{{WRAPPER}}', | |
| 26 | - $this->get_wrapper_css( $attributes ), | |
| 27 | - $this->get_wrapper_css( $attributes, 'Tablet' ), | |
| 28 | - $this->get_wrapper_css( $attributes, 'Mobile' ) | |
| 29 | - ); | |
| 30 | 26 | |
| 31 | 27 | $css_generator->add_class_styles( |
| 32 | 28 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container', |
| 33 | 29 | $this->get_info_box( $attributes ), |
| 34 | 30 | $this->get_info_box( $attributes, 'Tablet' ), |
| 35 | - $this->get_info_box( $attributes, 'Mobile' ) | |
| 31 | + $this->get_info_box( $attributes, 'Mobile' ), | |
| 32 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_info_box( $attributes, $device ); } ) | |
| 36 | 33 | ); |
| 37 | 34 | $css_generator->add_class_styles( |
| 38 | 35 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content', |
| 39 | 36 | $this->get_info_box_content( $attributes ), |
| 40 | 37 | $this->get_info_box_content( $attributes, 'Tablet' ), |
| 41 | - $this->get_info_box_content( $attributes, 'Mobile' ) | |
| 38 | + $this->get_info_box_content( $attributes, 'Mobile' ), | |
| 39 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_info_box_content( $attributes, $device ); } ) | |
| 42 | 40 | ); |
| 43 | 41 | |
| 44 | 42 | // badge starts |
| 45 | 43 | $css_generator->add_class_styles( |
| @@ -45,15 +43,17 @@ | ||
| 45 | 43 | $css_generator->add_class_styles( |
| 46 | 44 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-info-box-badge-link', |
| 47 | 45 | $this->get_badge_css( $attributes ), |
| 48 | 46 | $this->get_badge_css( $attributes, 'Tablet' ), |
| 49 | - $this->get_badge_css( $attributes, 'Mobile' ) | |
| 47 | + $this->get_badge_css( $attributes, 'Mobile' ), | |
| 48 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_badge_css( $attributes, $device ); } ) | |
| 50 | 49 | ); |
| 51 | 50 | $css_generator->add_class_styles( |
| 52 | 51 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-info-box-badge-link:hover', |
| 53 | 52 | $this->get_badge_hover_css( $attributes ), |
| 54 | 53 | $this->get_badge_hover_css( $attributes, 'Tablet' ), |
| 55 | - $this->get_badge_hover_css( $attributes, 'Mobile' ) | |
| 54 | + $this->get_badge_hover_css( $attributes, 'Mobile' ), | |
| 55 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_badge_hover_css( $attributes, $device ); } ) | |
| 56 | 56 | ); |
| 57 | 57 | $css_generator->add_class_styles( |
| 58 | 58 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-info-box-badge-link > .ablocks-info-box-badge-link-text', |
| 59 | 59 | $this->get_badge_text_css( $attributes ) |
| @@ -63,18 +63,26 @@ | ||
| 63 | 63 | $css_generator->add_class_styles( |
| 64 | 64 | '{{WRAPPER}}.ablocks-block--info-box .ablocks-block-container > .ablocks-icon-wrap, {{WRAPPER}}.ablocks-block--info-box .ablocks-block-container > a .ablocks-icon-wrap', |
| 65 | 65 | Icon::get_wrapper_css( $attributes ), |
| 66 | 66 | Icon::get_wrapper_css( $attributes, 'Tablet' ), |
| 67 | - Icon::get_wrapper_css( $attributes, 'Mobile' ) | |
| 67 | + Icon::get_wrapper_css( $attributes, 'Mobile' ), | |
| 68 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device ); } ) | |
| 68 | 69 | ); |
| 69 | 70 | $css_generator->add_class_styles( |
| 70 | - '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-icon-wrap > img.ablocks-image-icon', | |
| 71 | + '{{WRAPPER}}.ablocks-block--info-box .ablocks-block-container > .ablocks-icon-wrap, {{WRAPPER}}.ablocks-block--info-box .ablocks-block-container > a .ablocks-icon-wrap', | |
| 72 | + $this->get_icon_wrapper_extra_css( $attributes ), | |
| 73 | + $this->get_icon_wrapper_extra_css( $attributes, 'Tablet' ), | |
| 74 | + $this->get_icon_wrapper_extra_css( $attributes, 'Mobile' ), | |
| 75 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_wrapper_extra_css( $attributes, $device ); } ) | |
| 76 | + ); | |
| 77 | + $css_generator->add_class_styles( | |
| 78 | + '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-icon-wrap > img.ablocks-image-icon, {{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > a .ablocks-icon-wrap > img.ablocks-image-icon', | |
| 71 | 79 | Icon::get_element_image_css( $attributes ), |
| 72 | 80 | Icon::get_element_image_css( $attributes, 'Tablet' ), |
| 73 | 81 | Icon::get_element_image_css( $attributes, 'Mobile' ), |
| 74 | 82 | ); |
| 75 | 83 | $css_generator->add_class_styles( |
| 76 | - '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-icon-wrap > img.ablocks-image-icon:hover', | |
| 84 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-icon-wrap > img.ablocks-image-icon, {{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > a .ablocks-icon-wrap > img.ablocks-image-icon', | |
| 77 | 85 | Icon::get_element_image_hover_css( $attributes ), |
| 78 | 86 | Icon::get_element_image_hover_css( $attributes, 'Tablet' ), |
| 79 | 87 | Icon::get_element_image_hover_css( $attributes, 'Mobile' ), |
| 80 | 88 | ); |
| @@ -84,9 +92,9 @@ | ||
| 84 | 92 | Icon::get_element_css( $attributes, 'Tablet' ), |
| 85 | 93 | Icon::get_element_css( $attributes, 'Mobile' ), |
| 86 | 94 | ); |
| 87 | 95 | $css_generator->add_class_styles( |
| 88 | - '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-icon-wrap > svg.ablocks-svg-icon:hover', | |
| 96 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-icon-wrap > svg.ablocks-svg-icon', | |
| 89 | 97 | Icon::get_element_image_hover_css( $attributes ), |
| 90 | 98 | Icon::get_element_image_hover_css( $attributes, 'Tablet' ), |
| 91 | 99 | Icon::get_element_image_hover_css( $attributes, 'Mobile' ), |
| 92 | 100 | ); |
| @@ -93,8 +101,12 @@ | ||
| 93 | 101 | $css_generator->add_class_styles( |
| 94 | 102 | '{{WRAPPER}}.ablocks-block--info-box:hover .ablocks-block-container > .ablocks-icon-wrap svg.ablocks-svg-icon , {{WRAPPER}}.ablocks-block--info-box:hover .ablocks-block-container > a .ablocks-icon-wrap svg.ablocks-svg-icon', |
| 95 | 103 | $this->get_icon_css_hover( $attributes ), |
| 96 | 104 | ); |
| 105 | + $css_generator->add_class_styles( | |
| 106 | + '{{WRAPPER}}.ablocks-block--info-box:hover .ablocks-block-container > .ablocks-icon-wrap , {{WRAPPER}}.ablocks-block--info-box:hover .ablocks-block-container > a .ablocks-icon-wrap', | |
| 107 | + $this->get_icon_css_background_hover( $attributes ), | |
| 108 | + ); | |
| 97 | 109 | |
| 98 | 110 | // Heading starts |
| 99 | 111 | $desktop_heading_text_styles = $this->get_heading_text_css( $attributes ); |
| 100 | 112 | if ( ! empty( $attributes['headingTextColor'] ) ) { |
| @@ -103,15 +115,17 @@ | ||
| 103 | 115 | $css_generator->add_class_styles( |
| 104 | 116 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-heading', |
| 105 | 117 | $desktop_heading_text_styles, |
| 106 | 118 | $this->get_heading_text_css( $attributes, 'Tablet' ), |
| 107 | - $this->get_heading_text_css( $attributes, 'Mobile' ) | |
| 119 | + $this->get_heading_text_css( $attributes, 'Mobile' ), | |
| 120 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_heading_text_css( $attributes, $device ); } ) | |
| 108 | 121 | ); |
| 109 | 122 | $css_generator->add_class_styles( |
| 110 | 123 | '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-heading', |
| 111 | 124 | $this->get_heading_text_css_hover( $attributes ), |
| 112 | 125 | $this->get_heading_text_css_hover( $attributes, 'Tablet' ), |
| 113 | - $this->get_heading_text_css_hover( $attributes, 'Mobile' ) | |
| 126 | + $this->get_heading_text_css_hover( $attributes, 'Mobile' ), | |
| 127 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_heading_text_css_hover( $attributes, $device ); } ) | |
| 114 | 128 | ); |
| 115 | 129 | |
| 116 | 130 | // Sub Heading starts |
| 117 | 131 | $desktop_sub_heading_text_styles = $this->get_sub_heading_text_css( $attributes ); |
| @@ -121,15 +135,17 @@ | ||
| 121 | 135 | $css_generator->add_class_styles( |
| 122 | 136 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-sub-heading', |
| 123 | 137 | $desktop_sub_heading_text_styles, |
| 124 | 138 | $this->get_sub_heading_text_css( $attributes, 'Tablet' ), |
| 125 | - $this->get_sub_heading_text_css( $attributes, 'Mobile' ) | |
| 139 | + $this->get_sub_heading_text_css( $attributes, 'Mobile' ), | |
| 140 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_sub_heading_text_css( $attributes, $device ); } ) | |
| 126 | 141 | ); |
| 127 | 142 | $css_generator->add_class_styles( |
| 128 | 143 | '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-sub-heading', |
| 129 | 144 | $this->get_sub_heading_text_css_hover( $attributes ), |
| 130 | 145 | $this->get_sub_heading_text_css_hover( $attributes, 'Tablet' ), |
| 131 | - $this->get_sub_heading_text_css_hover( $attributes, 'Mobile' ) | |
| 146 | + $this->get_sub_heading_text_css_hover( $attributes, 'Mobile' ), | |
| 147 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_sub_heading_text_css_hover( $attributes, $device ); } ) | |
| 132 | 148 | ); |
| 133 | 149 | |
| 134 | 150 | // Description starts |
| 135 | 151 | $desktop_des_text_style = $this->get_des_text_css( $attributes ); |
| @@ -145,9 +161,10 @@ | ||
| 145 | 161 | $css_generator->add_class_styles( |
| 146 | 162 | '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-text', |
| 147 | 163 | $this->get_des_text_css_hover( $attributes ), |
| 148 | 164 | $this->get_des_text_css_hover( $attributes, 'Tablet' ), |
| 149 | - $this->get_des_text_css_hover( $attributes, 'Mobile' ) | |
| 165 | + $this->get_des_text_css_hover( $attributes, 'Mobile' ), | |
| 166 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_des_text_css_hover( $attributes, $device ); } ) | |
| 150 | 167 | ); |
| 151 | 168 | $css_generator->add_class_styles( |
| 152 | 169 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-text-drop-caps::first-letter', |
| 153 | 170 | $this->get_des_drop_text_css( $attributes ), |
| @@ -171,9 +188,10 @@ | ||
| 171 | 188 | $css_generator->add_class_styles( |
| 172 | 189 | '{{WRAPPER}} .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__fill > .ablocks-icon-wrap, {{WRAPPER}} .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__unfill > .ablocks-icon-wrap', |
| 173 | 190 | Icon::get_wrapper_css( $attributes, '', 'starIcon' ), |
| 174 | 191 | Icon::get_wrapper_css( $attributes, 'Tablet', 'starIcon' ), |
| 175 | - Icon::get_wrapper_css( $attributes, 'Mobile', 'starIcon' ) | |
| 192 | + Icon::get_wrapper_css( $attributes, 'Mobile', 'starIcon' ), | |
| 193 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device, 'starIcon' ); } ) | |
| 176 | 194 | ); |
| 177 | 195 | // rating icon spacing css |
| 178 | 196 | $css_generator->add_class_styles( |
| 179 | 197 | '{{WRAPPER}} .ablocks-info-box-star-ratings-icons', |
| @@ -217,9 +235,10 @@ | ||
| 217 | 235 | $css_generator->add_class_styles( |
| 218 | 236 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-btn-link', |
| 219 | 237 | $this->get_button_css( $attributes ), |
| 220 | 238 | $this->get_button_css( $attributes, 'Tablet' ), |
| 221 | - $this->get_button_css( $attributes, 'Mobile' ) | |
| 239 | + $this->get_button_css( $attributes, 'Mobile' ), | |
| 240 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_button_css( $attributes, $device ); } ) | |
| 222 | 241 | ); |
| 223 | 242 | // Generate button CSS end |
| 224 | 243 | // Generate button hover CSS start |
| 225 | 244 | $css_generator->add_class_styles( |
| @@ -225,9 +244,10 @@ | ||
| 225 | 244 | $css_generator->add_class_styles( |
| 226 | 245 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-btn-link:hover', |
| 227 | 246 | $this->get_button_hover_css( $attributes ), |
| 228 | 247 | $this->get_button_hover_css( $attributes, 'Tablet' ), |
| 229 | - $this->get_button_hover_css( $attributes, 'Mobile' ) | |
| 248 | + $this->get_button_hover_css( $attributes, 'Mobile' ), | |
| 249 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_button_hover_css( $attributes, $device ); } ) | |
| 230 | 250 | ); |
| 231 | 251 | // Generate button icon hover CSS |
| 232 | 252 | $css_generator->add_class_styles( |
| 233 | 253 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-btn-link:hover > .ablocks-icon-wrap > svg.ablocks-svg-icon', |
| @@ -232,9 +252,10 @@ | ||
| 232 | 252 | $css_generator->add_class_styles( |
| 233 | 253 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-btn-link:hover > .ablocks-icon-wrap > svg.ablocks-svg-icon', |
| 234 | 254 | $this->get_button_icon_hover_css( $attributes ), |
| 235 | 255 | $this->get_button_icon_hover_css( $attributes, 'Tablet' ), |
| 236 | - $this->get_button_icon_hover_css( $attributes, 'Mobile' ) | |
| 256 | + $this->get_button_icon_hover_css( $attributes, 'Mobile' ), | |
| 257 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_button_icon_hover_css( $attributes, $device ); } ) | |
| 237 | 258 | ); |
| 238 | 259 | // Generate button text CSS start |
| 239 | 260 | $css_generator->add_class_styles( |
| 240 | 261 | '{{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container > .ablocks-block--info-box__content > .ablocks-info-box-btn-link > .ablocks-info-box-btn-link-text', |
| @@ -244,9 +265,10 @@ | ||
| 244 | 265 | $css_generator->add_class_styles( |
| 245 | 266 | '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap', |
| 246 | 267 | Icon::get_wrapper_css( $attributes, '', 'btnIcon' ), |
| 247 | 268 | Icon::get_wrapper_css( $attributes, 'Tablet', 'btnIcon' ), |
| 248 | - Icon::get_wrapper_css( $attributes, 'Mobile', 'btnIcon' ) | |
| 269 | + Icon::get_wrapper_css( $attributes, 'Mobile', 'btnIcon' ), | |
| 270 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device, 'btnIcon' ); } ) | |
| 249 | 271 | ); |
| 250 | 272 | $css_generator->add_class_styles( |
| 251 | 273 | '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap > svg.ablocks-svg-icon', |
| 252 | 274 | Icon::get_element_css( $attributes, '', 'btnIcon' ), |
| @@ -258,22 +280,363 @@ | ||
| 258 | 280 | Icon::get_element_image_hover_css( $attributes, '', 'btnIcon' ), |
| 259 | 281 | Icon::get_element_image_hover_css( $attributes, 'Tablet', 'btnIcon' ), |
| 260 | 282 | Icon::get_element_image_hover_css( $attributes, 'Mobile', 'btnIcon' ), |
| 261 | 283 | ); |
| 284 | + $css_generator->add_class_styles( | |
| 285 | + '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap:hover', | |
| 286 | + Icon::get_wrapper_hover_css( $attributes, '', 'btnIcon' ), | |
| 287 | + Icon::get_wrapper_hover_css( $attributes, 'Tablet', 'btnIcon' ), | |
| 288 | + Icon::get_wrapper_hover_css( $attributes, 'Mobile', 'btnIcon' ), | |
| 289 | + ); | |
| 290 | + // Specificity override: the flex rule above has (0,2,0); the global hide rule also has (0,2,0) but | |
| 291 | + // comes earlier in the CSS output, so flex wins due to source order. This override uses | |
| 292 | + // {{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-* → (0,3,0), placed last, | |
| 293 | + // so display:none always beats display:flex regardless of order. Restore uses flex (not block) | |
| 294 | + // so the Info Box layout stays intact when a device-hidden block becomes visible at a smaller breakpoint. | |
| 295 | + $css_generator->add_class_styles( | |
| 296 | + '{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-desktop,{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-tablet,{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-mobile', | |
| 297 | + ! empty( $attributes['_hide_on_desktop'] ) ? [ 'display' => 'none' ] : [], | |
| 298 | + ! empty( $attributes['_hide_on_tablet'] ) | |
| 299 | + ? [ 'display' => 'none' ] | |
| 300 | + : ( ! empty( $attributes['_hide_on_desktop'] ) ? [ 'display' => 'flex' ] : [] ), | |
| 301 | + ! empty( $attributes['_hide_on_mobile'] ) | |
| 302 | + ? [ 'display' => 'none' ] | |
| 303 | + : ( ! empty( $attributes['_hide_on_tablet'] ) ? [ 'display' => 'flex' ] : [] ) | |
| 304 | + ); | |
| 305 | + return $css_generator->generate_css(); | |
| 306 | + } | |
| 307 | + public function build_css_v2( $attributes ) { | |
| 308 | + $css_generator = new CssGeneratorV2( $attributes, $this->block_name ); | |
| 262 | 309 | |
| 310 | + $css_generator->add_class_styles( | |
| 311 | + '{{WRAPPER}}:not(.ablocks-has-block-container), {{WRAPPER}}.ablocks-block--info-box > .ablocks-block-container', | |
| 312 | + $this->get_info_box( $attributes ), | |
| 313 | + $this->get_info_box( $attributes, 'Tablet' ), | |
| 314 | + $this->get_info_box( $attributes, 'Mobile' ), | |
| 315 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_info_box( $attributes, $device ); } ) | |
| 316 | + ); | |
| 317 | + $css_generator->add_class_styles( | |
| 318 | + '{{WRAPPER}} .ablocks-block--info-box__content', | |
| 319 | + $this->get_info_box_content( $attributes ), | |
| 320 | + $this->get_info_box_content( $attributes, 'Tablet' ), | |
| 321 | + $this->get_info_box_content( $attributes, 'Mobile' ), | |
| 322 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_info_box_content( $attributes, $device ); } ) | |
| 323 | + ); | |
| 324 | + | |
| 325 | + // badge starts | |
| 326 | + $css_generator->add_class_styles( | |
| 327 | + '{{WRAPPER}} .ablocks-info-box-badge-link', | |
| 328 | + $this->get_badge_css( $attributes ), | |
| 329 | + $this->get_badge_css( $attributes, 'Tablet' ), | |
| 330 | + $this->get_badge_css( $attributes, 'Mobile' ), | |
| 331 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_badge_css( $attributes, $device ); } ) | |
| 332 | + ); | |
| 333 | + $css_generator->add_class_styles( | |
| 334 | + '{{WRAPPER}} .ablocks-info-box-badge-link:hover', | |
| 335 | + $this->get_badge_hover_css( $attributes ), | |
| 336 | + $this->get_badge_hover_css( $attributes, 'Tablet' ), | |
| 337 | + $this->get_badge_hover_css( $attributes, 'Mobile' ), | |
| 338 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_badge_hover_css( $attributes, $device ); } ) | |
| 339 | + ); | |
| 340 | + $css_generator->add_class_styles( | |
| 341 | + '{{WRAPPER}} .ablocks-info-box-badge-link > .ablocks-info-box-badge-link-text', | |
| 342 | + $this->get_badge_text_css( $attributes ) | |
| 343 | + ); | |
| 344 | + | |
| 345 | + // Icon Style | |
| 346 | + $css_generator->add_class_styles( | |
| 347 | + '{{WRAPPER}}:not(.ablocks-has-block-container) > .ablocks-icon-wrap, | |
| 348 | + {{WRAPPER}} > .ablocks-block-container > .ablocks-icon-wrap, | |
| 349 | + {{WRAPPER}}:not(.ablocks-has-block-container) > a .ablocks-icon-wrap, | |
| 350 | + {{WRAPPER}} > .ablocks-block-container > a .ablocks-icon-wrap', | |
| 351 | + Icon::get_wrapper_css( $attributes ), | |
| 352 | + Icon::get_wrapper_css( $attributes, 'Tablet' ), | |
| 353 | + Icon::get_wrapper_css( $attributes, 'Mobile' ), | |
| 354 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device ); } ) | |
| 355 | + ); | |
| 356 | + // Icon Style | |
| 357 | + $css_generator->add_class_styles( | |
| 358 | + '{{WRAPPER}}:not(.ablocks-has-block-container) > .ablocks-icon-wrap:hover, | |
| 359 | + {{WRAPPER}} > .ablocks-block-container > .ablocks-icon-wrap:hover, | |
| 360 | + {{WRAPPER}}:not(.ablocks-has-block-container) > a .ablocks-icon-wrap:hover, | |
| 361 | + {{WRAPPER}} > .ablocks-block-container > a .ablocks-icon-wrap:hover', | |
| 362 | + Icon::get_wrapper_hover_css( $attributes ), | |
| 363 | + Icon::get_wrapper_hover_css( $attributes, 'Tablet' ), | |
| 364 | + Icon::get_wrapper_hover_css( $attributes, 'Mobile' ), | |
| 365 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_hover_css( $attributes, $device ); } ) | |
| 366 | + ); | |
| 367 | + $css_generator->add_class_styles( | |
| 368 | + '{{WRAPPER}}:not(.ablocks-has-block-container) > .ablocks-icon-wrap, | |
| 369 | + {{WRAPPER}} > .ablocks-block-container > .ablocks-icon-wrap, | |
| 370 | + {{WRAPPER}}:not(.ablocks-has-block-container) > a .ablocks-icon-wrap, | |
| 371 | + {{WRAPPER}} > .ablocks-block-container > a .ablocks-icon-wrap', | |
| 372 | + $this->get_icon_wrapper_extra_css( $attributes ), | |
| 373 | + $this->get_icon_wrapper_extra_css( $attributes, 'Tablet' ), | |
| 374 | + $this->get_icon_wrapper_extra_css( $attributes, 'Mobile' ), | |
| 375 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_icon_wrapper_extra_css( $attributes, $device ); } ) | |
| 376 | + ); | |
| 377 | + $css_generator->add_class_styles( | |
| 378 | + '{{WRAPPER}}:not(.ablocks-has-block-container) > .ablocks-icon-wrap > img.ablocks-image-icon, {{WRAPPER}} > .ablocks-block-container > .ablocks-icon-wrap > img.ablocks-image-icon, {{WRAPPER}} > a .ablocks-icon-wrap > img.ablocks-image-icon', | |
| 379 | + Icon::get_element_image_css( $attributes ), | |
| 380 | + Icon::get_element_image_css( $attributes, 'Tablet' ), | |
| 381 | + Icon::get_element_image_css( $attributes, 'Mobile' ), | |
| 382 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_css( $attributes, $device ); } ) | |
| 383 | + ); | |
| 384 | + $css_generator->add_class_styles( | |
| 385 | + '{{WRAPPER}}:not(.ablocks-has-block-container):hover > .ablocks-icon-wrap > img.ablocks-image-icon, {{WRAPPER}}:hover > .ablocks-block-container > .ablocks-icon-wrap > img.ablocks-image-icon , {{WRAPPER}}:hover > a .ablocks-icon-wrap > img.ablocks-image-icon', | |
| 386 | + Icon::get_element_image_hover_css( $attributes ), | |
| 387 | + Icon::get_element_image_hover_css( $attributes, 'Tablet' ), | |
| 388 | + Icon::get_element_image_hover_css( $attributes, 'Mobile' ), | |
| 389 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_hover_css( $attributes, $device ); } ) | |
| 390 | + ); | |
| 391 | + $css_generator->add_class_styles( | |
| 392 | + '{{WRAPPER}}:not(.ablocks-has-block-container) > .ablocks-icon-wrap > svg.ablocks-svg-icon, {{WRAPPER}} > .ablocks-block-container > .ablocks-icon-wrap > svg.ablocks-svg-icon', | |
| 393 | + Icon::get_element_css( $attributes ), | |
| 394 | + Icon::get_element_css( $attributes, 'Tablet' ), | |
| 395 | + Icon::get_element_css( $attributes, 'Mobile' ), | |
| 396 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_css( $attributes, $device ); } ) | |
| 397 | + ); | |
| 398 | + $css_generator->add_class_styles( | |
| 399 | + '{{WRAPPER}}:not(.ablocks-has-block-container):hover > .ablocks-icon-wrap > svg.ablocks-svg-icon, {{WRAPPER}} > .ablocks-block-container > .ablocks-icon-wrap > svg.ablocks-svg-icon', | |
| 400 | + Icon::get_element_image_hover_css( $attributes ), | |
| 401 | + Icon::get_element_image_hover_css( $attributes, 'Tablet' ), | |
| 402 | + Icon::get_element_image_hover_css( $attributes, 'Mobile' ), | |
| 403 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_hover_css( $attributes, $device ); } ) | |
| 404 | + ); | |
| 405 | + $css_generator->add_class_styles( | |
| 406 | + '{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-block--info-box:hover > .ablocks-icon-wrap svg.ablocks-svg-icon , | |
| 407 | + {{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-icon-wrap svg.ablocks-svg-icon , | |
| 408 | + {{WRAPPER}}:not(.ablocks-has-block-container).ablocks-block--info-box:hover > a .ablocks-icon-wrap svg.ablocks-svg-icon , | |
| 409 | + {{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > a .ablocks-icon-wrap svg.ablocks-svg-icon', | |
| 410 | + $this->get_icon_css_hover( $attributes ), | |
| 411 | + ); | |
| 412 | + $css_generator->add_class_styles( | |
| 413 | + '{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-block--info-box:hover > .ablocks-icon-wrap, | |
| 414 | + {{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > .ablocks-icon-wrap, | |
| 415 | + {{WRAPPER}}:not(.ablocks-has-block-container).ablocks-block--info-box:hover > a .ablocks-icon-wrap, | |
| 416 | + {{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block-container > a .ablocks-icon-wrap', | |
| 417 | + $this->get_icon_css_background_hover( $attributes ), | |
| 418 | + ); | |
| 419 | + | |
| 420 | + // Heading starts | |
| 421 | + $css_generator->add_class_styles( | |
| 422 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-heading', | |
| 423 | + $this->get_heading_text_css( $attributes ), | |
| 424 | + $this->get_heading_text_css( $attributes, 'Tablet' ), | |
| 425 | + $this->get_heading_text_css( $attributes, 'Mobile' ), | |
| 426 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_heading_text_css( $attributes, $device ); } ) | |
| 427 | + ); | |
| 428 | + $css_generator->add_class_styles( | |
| 429 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block--info-box__content > .ablocks-info-box-heading', | |
| 430 | + $this->get_heading_text_css_hover( $attributes ), | |
| 431 | + $this->get_heading_text_css_hover( $attributes, 'Tablet' ), | |
| 432 | + $this->get_heading_text_css_hover( $attributes, 'Mobile' ), | |
| 433 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_heading_text_css_hover( $attributes, $device ); } ) | |
| 434 | + ); | |
| 435 | + | |
| 436 | + // Sub Heading starts | |
| 437 | + $css_generator->add_class_styles( | |
| 438 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-sub-heading', | |
| 439 | + $this->get_sub_heading_text_css( $attributes ), | |
| 440 | + $this->get_sub_heading_text_css( $attributes, 'Tablet' ), | |
| 441 | + $this->get_sub_heading_text_css( $attributes, 'Mobile' ), | |
| 442 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_sub_heading_text_css( $attributes, $device ); } ) | |
| 443 | + ); | |
| 444 | + $css_generator->add_class_styles( | |
| 445 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block--info-box__content > .ablocks-info-box-sub-heading', | |
| 446 | + $this->get_sub_heading_text_css_hover( $attributes ), | |
| 447 | + $this->get_sub_heading_text_css_hover( $attributes, 'Tablet' ), | |
| 448 | + $this->get_sub_heading_text_css_hover( $attributes, 'Mobile' ), | |
| 449 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_sub_heading_text_css_hover( $attributes, $device ); } ) | |
| 450 | + ); | |
| 451 | + | |
| 452 | + // Description starts | |
| 453 | + $css_generator->add_class_styles( | |
| 454 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-text', | |
| 455 | + $this->get_des_text_css( $attributes ), | |
| 456 | + $this->get_des_text_css( $attributes, 'Tablet' ), | |
| 457 | + $this->get_des_text_css( $attributes, 'Mobile' ), | |
| 458 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_des_text_css( $attributes, $device ); } ) | |
| 459 | + ); | |
| 460 | + $css_generator->add_class_styles( | |
| 461 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block--info-box__content > .ablocks-info-box-text', | |
| 462 | + $this->get_des_text_css_hover( $attributes ), | |
| 463 | + $this->get_des_text_css_hover( $attributes, 'Tablet' ), | |
| 464 | + $this->get_des_text_css_hover( $attributes, 'Mobile' ), | |
| 465 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_des_text_css_hover( $attributes, $device ); } ) | |
| 466 | + ); | |
| 467 | + $css_generator->add_class_styles( | |
| 468 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-text-drop-caps::first-letter', | |
| 469 | + $this->get_des_drop_text_css( $attributes ), | |
| 470 | + $this->get_des_drop_text_css( $attributes, 'Tablet' ), | |
| 471 | + $this->get_des_drop_text_css( $attributes, 'Mobile' ), | |
| 472 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_des_drop_text_css( $attributes, $device ); } ) | |
| 473 | + ); | |
| 474 | + | |
| 475 | + // rating icon css | |
| 476 | + $css_generator->add_class_styles( | |
| 477 | + '{{WRAPPER}} .ablocks-info-box-star-ratings', | |
| 478 | + $this->get_container_css( $attributes ), | |
| 479 | + $this->get_container_css( $attributes, 'Tablet' ), | |
| 480 | + $this->get_container_css( $attributes, 'Mobile' ), | |
| 481 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_container_css( $attributes, $device ); } ) | |
| 482 | + ); | |
| 483 | + $css_generator->add_class_styles( | |
| 484 | + '{{WRAPPER}} .ablocks-info-box-star-ratings', | |
| 485 | + $this->get_rating_css( $attributes ), | |
| 486 | + $this->get_rating_css( $attributes, 'Tablet' ), | |
| 487 | + $this->get_rating_css( $attributes, 'Mobile' ), | |
| 488 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_rating_css( $attributes, $device ); } ) | |
| 489 | + ); | |
| 490 | + $css_generator->add_class_styles( | |
| 491 | + '{{WRAPPER}} .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__fill > .ablocks-icon-wrap, {{WRAPPER}} .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__unfill > .ablocks-icon-wrap', | |
| 492 | + Icon::get_wrapper_css( $attributes, '', 'starIcon' ), | |
| 493 | + Icon::get_wrapper_css( $attributes, 'Tablet', 'starIcon' ), | |
| 494 | + Icon::get_wrapper_css( $attributes, 'Mobile', 'starIcon' ), | |
| 495 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device, 'starIcon' ); } ) | |
| 496 | + ); | |
| 497 | + // rating icon spacing css | |
| 498 | + $css_generator->add_class_styles( | |
| 499 | + '{{WRAPPER}} .ablocks-info-box-star-ratings-icons', | |
| 500 | + $this->get_rating_icon_spacing_css( $attributes ), | |
| 501 | + $this->get_rating_icon_spacing_css( $attributes, 'Tablet' ), | |
| 502 | + $this->get_rating_icon_spacing_css( $attributes, 'Mobile' ), | |
| 503 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_rating_icon_spacing_css( $attributes, $device ); } ) | |
| 504 | + ); | |
| 505 | + $css_generator->add_class_styles( | |
| 506 | + '{{WRAPPER}} .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__fill > .ablocks-icon-wrap > svg', | |
| 507 | + $this->get_fill_rating_css( $attributes ), | |
| 508 | + $this->get_fill_rating_css( $attributes, 'Tablet' ), | |
| 509 | + $this->get_fill_rating_css( $attributes, 'Mobile' ), | |
| 510 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_fill_rating_css( $attributes, $device ); } ) | |
| 511 | + ); | |
| 512 | + $css_generator->add_class_styles( | |
| 513 | + '{{WRAPPER}} .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__unfill > .ablocks-icon-wrap > svg', | |
| 514 | + $this->get_unfill_rating_css( $attributes ), | |
| 515 | + $this->get_unfill_rating_css( $attributes, 'Tablet' ), | |
| 516 | + $this->get_unfill_rating_css( $attributes, 'Mobile' ), | |
| 517 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_unfill_rating_css( $attributes, $device ); } ) | |
| 518 | + ); | |
| 519 | + $css_generator->add_class_styles( | |
| 520 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block--info-box__content > .ablocks-info-box-star-ratings > .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__fill > .ablocks-icon-wrap > svg', | |
| 521 | + $this->get_fill_rating_css_hover( $attributes ), | |
| 522 | + $this->get_fill_rating_css_hover( $attributes, 'Tablet' ), | |
| 523 | + $this->get_fill_rating_css_hover( $attributes, 'Mobile' ), | |
| 524 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_fill_rating_css_hover( $attributes, $device ); } ) | |
| 525 | + ); | |
| 526 | + $css_generator->add_class_styles( | |
| 527 | + '{{WRAPPER}}.ablocks-block--info-box:hover > .ablocks-block--info-box__content > .ablocks-info-box-star-ratings > .ablocks-info-box-star-ratings-icons > .ablocks-info-box-rating > .ablocks-info-box-rating__unfill > .ablocks-icon-wrap > svg', | |
| 528 | + $this->get_unfill_rating_css_hover( $attributes ), | |
| 529 | + $this->get_unfill_rating_css_hover( $attributes, 'Tablet' ), | |
| 530 | + $this->get_unfill_rating_css_hover( $attributes, 'Mobile' ), | |
| 531 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_unfill_rating_css_hover( $attributes, $device ); } ) | |
| 532 | + ); | |
| 533 | + // rating number css | |
| 534 | + $css_generator->add_class_styles( | |
| 535 | + '{{WRAPPER}} .ablocks-info-box-star-rating-number', | |
| 536 | + $this->get_rating_number_css( $attributes ), | |
| 537 | + $this->get_rating_number_css( $attributes, 'Tablet' ), | |
| 538 | + $this->get_rating_number_css( $attributes, 'Mobile' ), | |
| 539 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_rating_number_css( $attributes, $device ); } ) | |
| 540 | + ); | |
| 541 | + | |
| 542 | + // Generate button CSS start | |
| 543 | + $css_generator->add_class_styles( | |
| 544 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-btn-link', | |
| 545 | + $this->get_button_css( $attributes ), | |
| 546 | + $this->get_button_css( $attributes, 'Tablet' ), | |
| 547 | + $this->get_button_css( $attributes, 'Mobile' ), | |
| 548 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_button_css( $attributes, $device ); } ) | |
| 549 | + ); | |
| 550 | + // Generate button CSS end | |
| 551 | + // Generate button hover CSS start | |
| 552 | + $css_generator->add_class_styles( | |
| 553 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-btn-link:hover', | |
| 554 | + $this->get_button_hover_css( $attributes ), | |
| 555 | + $this->get_button_hover_css( $attributes, 'Tablet' ), | |
| 556 | + $this->get_button_hover_css( $attributes, 'Mobile' ), | |
| 557 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_button_hover_css( $attributes, $device ); } ) | |
| 558 | + ); | |
| 559 | + // Generate button icon hover CSS | |
| 560 | + $css_generator->add_class_styles( | |
| 561 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-btn-link:hover > .ablocks-icon-wrap > svg.ablocks-svg-icon', | |
| 562 | + $this->get_button_icon_hover_css( $attributes ), | |
| 563 | + $this->get_button_icon_hover_css( $attributes, 'Tablet' ), | |
| 564 | + $this->get_button_icon_hover_css( $attributes, 'Mobile' ), | |
| 565 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_button_icon_hover_css( $attributes, $device ); } ) | |
| 566 | + ); | |
| 567 | + // Generate button text CSS start | |
| 568 | + $css_generator->add_class_styles( | |
| 569 | + '{{WRAPPER}} .ablocks-block--info-box__content > .ablocks-info-box-btn-link > .ablocks-info-box-btn-link-text', | |
| 570 | + $this->get_button_text_css( $attributes ) | |
| 571 | + ); | |
| 572 | + // Generate button icon CSS start | |
| 573 | + $css_generator->add_class_styles( | |
| 574 | + '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap', | |
| 575 | + Icon::get_wrapper_css( $attributes, '', 'btnIcon' ), | |
| 576 | + Icon::get_wrapper_css( $attributes, 'Tablet', 'btnIcon' ), | |
| 577 | + Icon::get_wrapper_css( $attributes, 'Mobile', 'btnIcon' ), | |
| 578 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_css( $attributes, $device, 'btnIcon' ); } ) | |
| 579 | + ); | |
| 580 | + $css_generator->add_class_styles( | |
| 581 | + '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap > svg.ablocks-svg-icon', | |
| 582 | + Icon::get_element_css( $attributes, '', 'btnIcon' ), | |
| 583 | + Icon::get_element_css( $attributes, 'Tablet', 'btnIcon' ), | |
| 584 | + Icon::get_element_css( $attributes, 'Mobile', 'btnIcon' ), | |
| 585 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_css( $attributes, $device, 'btnIcon' ); } ) | |
| 586 | + ); | |
| 587 | + $css_generator->add_class_styles( | |
| 588 | + '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap > svg.ablocks-svg-icon:hover', | |
| 589 | + Icon::get_element_image_hover_css( $attributes, '', 'btnIcon' ), | |
| 590 | + Icon::get_element_image_hover_css( $attributes, 'Tablet', 'btnIcon' ), | |
| 591 | + Icon::get_element_image_hover_css( $attributes, 'Mobile', 'btnIcon' ), | |
| 592 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_element_image_hover_css( $attributes, $device, 'btnIcon' ); } ) | |
| 593 | + ); | |
| 594 | + $css_generator->add_class_styles( | |
| 595 | + '{{WRAPPER}} .ablocks-info-box-btn-link > .ablocks-icon-wrap:hover', | |
| 596 | + Icon::get_wrapper_hover_css( $attributes, '', 'btnIcon' ), | |
| 597 | + Icon::get_wrapper_hover_css( $attributes, 'Tablet', 'btnIcon' ), | |
| 598 | + Icon::get_wrapper_hover_css( $attributes, 'Mobile', 'btnIcon' ), | |
| 599 | + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return Icon::get_wrapper_hover_css( $attributes, $device, 'btnIcon' ); } ) | |
| 600 | + ); | |
| 601 | + $css_generator->add_class_styles( | |
| 602 | + '{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-desktop,{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-tablet,{{WRAPPER}}:not(.ablocks-has-block-container).ablocks-hide-on-mobile', | |
| 603 | + ! empty( $attributes['_hide_on_desktop'] ) ? [ 'display' => 'none' ] : [], | |
| 604 | + ! empty( $attributes['_hide_on_tablet'] ) | |
| 605 | + ? [ 'display' => 'none' ] | |
| 606 | + : ( ! empty( $attributes['_hide_on_desktop'] ) ? [ 'display' => 'flex' ] : [] ), | |
| 607 | + ! empty( $attributes['_hide_on_mobile'] ) | |
| 608 | + ? [ 'display' => 'none' ] | |
| 609 | + : ( ! empty( $attributes['_hide_on_tablet'] ) ? [ 'display' => 'flex' ] : [] ) | |
| 610 | + ); | |
| 263 | 611 | return $css_generator->generate_css(); |
| 264 | 612 | } |
| 265 | - | |
| 266 | - public function get_wrapper_css( $attributes, $device = '' ) { | |
| 267 | - return isset( $attributes['alignment'] ) ? Alignment::get_css( $attributes['alignment'], 'text-align', $device ) : []; | |
| 613 | + public function build_css( $attributes ) { | |
| 614 | + if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) { | |
| 615 | + return $this->build_css_v2( $attributes ); | |
| 616 | + } | |
| 617 | + return $this->build_css_v1( $attributes ); | |
| 268 | 618 | } |
| 269 | 619 | |
| 270 | 620 | public function get_info_box( $attributes, $device = '' ) { |
| 271 | 621 | $css = []; |
| 272 | 622 | |
| 273 | - if ( isset( $attributes['stack'] ) ) { | |
| 623 | + // Temporary approch instead of attribute migration. Might remove it in future | |
| 624 | + $iconPlacement = isset( $attributes['iconPlacement'][ 'value' . $device ] ) ? $attributes['iconPlacement'][ 'value' . $device ] : ''; | |
| 625 | + if ( ! isset( $attributes['iconPlacement'] ) | |
| 626 | + || ( | |
| 627 | + $attributes['stack'] !== '' | |
| 628 | + && $iconPlacement !== $attributes['stack'] | |
| 629 | + ) | |
| 630 | + ) { | |
| 631 | + $attributes['iconPlacement'][ 'value' . $device ] = $attributes['stack']; | |
| 632 | + $attributes['stack'] = ''; | |
| 633 | + } | |
| 634 | + // Temporary approch instead of attribute migration. Might remove it in future | |
| 635 | + | |
| 636 | + if ( isset( $attributes['iconPlacement'][ 'value' . $device ] ) ) { | |
| 274 | 637 | $css['display'] = 'flex'; |
| 275 | - $css['flex-direction'] = $attributes['stack']; | |
| 638 | + $css['flex-direction'] = $attributes['iconPlacement'][ 'value' . $device ]; | |
| 276 | 639 | } |
| 277 | 640 | |
| 278 | 641 | if ( isset( $attributes['iconAlignment'][ 'value' . $device ] ) ) { |
| 279 | 642 | $css['align-items'] = $attributes['iconAlignment'][ 'value' . $device ]; |
| @@ -320,18 +683,20 @@ | ||
| 320 | 683 | $css['top'] = 'auto'; |
| 321 | 684 | $css['left'] = 'auto'; |
| 322 | 685 | }//end if |
| 323 | 686 | }//end if |
| 324 | - if ( ! empty( $attributes['badgeTextColor'] ) ) { | |
| 325 | - $css['color'] = $attributes['badgeTextColor']; | |
| 326 | - } | |
| 687 | + | |
| 327 | 688 | if ( ! empty( $attributes['badgeBackground'] ) ) { |
| 328 | - $css['background'] = $attributes['badgeBackground']; | |
| 689 | + $css['background'] = Color::get_css( | |
| 690 | + isset( $attributes['badgeBackground'] ) ? $attributes['badgeBackground'] : ''); | |
| 691 | + | |
| 329 | 692 | } elseif ( ! empty( $attributes['badgeType'] ) ) { |
| 330 | 693 | $css['background'] = $attributes['badgeType']; |
| 331 | 694 | } |
| 695 | + $typographyGlobal = ! empty( $attributes['badgeTypographyGlobal'] ) ? $attributes['badgeTypographyGlobal'] : array(); | |
| 332 | 696 | |
| 333 | 697 | return array_merge( |
| 698 | + [ 'color' => Color::get_css( isset( $attributes['badgeTextColorH'] ) ? $attributes['badgeTextColor'] : '' ) ], | |
| 334 | 699 | Range::get_css([ |
| 335 | 700 | 'attributeValue' => $attributes['badgeTransition'], |
| 336 | 701 | 'attribute_object_key' => 'value', |
| 337 | 702 | 'defaultValue' => 0, |
| @@ -340,24 +705,18 @@ | ||
| 340 | 705 | 'device' => $device, |
| 341 | 706 | ]), |
| 342 | 707 | $css, |
| 343 | 708 | Border::get_css( $attributes['badgeBorder'], '', $device ), |
| 344 | - Typography::get_css( $attributes['badgeTypography'], '', $device ), | |
| 709 | + Typography::get_css( $attributes['badgeTypography'], '', $device, $typographyGlobal ), | |
| 345 | 710 | Dimensions::get_css( $attributes['badgePadding'], 'padding', $device ), |
| 346 | 711 | ); |
| 347 | 712 | } |
| 348 | 713 | public function get_badge_hover_css( $attributes, $device = '' ) { |
| 349 | 714 | $css = []; |
| 350 | - | |
| 351 | - if ( ! empty( $attributes['badgeTextColorH'] ) ) { | |
| 352 | - $css['color'] = $attributes['badgeTextColorH']; | |
| 353 | - } | |
| 354 | - if ( ! empty( $attributes['badgeBackgroundH'] ) ) { | |
| 355 | - $css['background'] = $attributes['badgeBackgroundH']; | |
| 356 | - } | |
| 357 | - | |
| 358 | 715 | return array_merge( |
| 359 | 716 | $css, |
| 717 | + [ 'color' => Color::get_css( isset( $attributes['badgeTextColorH'] ) ? $attributes['badgeTextColorH'] : '' ) ], | |
| 718 | + [ 'background' => Color::get_css( isset( $attributes['badgeBackgroundH'] ) ? $attributes['badgeBackgroundH'] : '' ) ], | |
| 360 | 719 | Border::get_css( $attributes['badgeBorder'], '', $device ), |
| 361 | 720 | ); |
| 362 | 721 | } |
| 363 | 722 | public function get_badge_text_css( $attributes, $device = '' ) { |
| @@ -363,14 +722,37 @@ | ||
| 363 | 722 | public function get_badge_text_css( $attributes, $device = '' ) { |
| 364 | 723 | return TextShadow::get_css( $attributes['badgeTextShadow'] ); |
| 365 | 724 | } |
| 366 | 725 | |
| 726 | + public function get_icon_wrapper_extra_css( $attributes, $device = '' ) { | |
| 727 | + $css = []; | |
| 367 | 728 | |
| 729 | + return array_merge( | |
| 730 | + $css, | |
| 731 | + Dimensions::get_css( $attributes['iconMargin'], 'margin', $device ), | |
| 732 | + ); | |
| 733 | + } | |
| 368 | 734 | |
| 369 | 735 | public function get_icon_css_hover( $attributes, $device = '' ) { |
| 370 | 736 | $css = []; |
| 371 | - if ( ! empty( $attributes['iconPrimaryColorH'] ) ) { | |
| 372 | - $css['fill'] = $attributes['iconPrimaryColorH']; | |
| 737 | + | |
| 738 | + return array_merge( | |
| 739 | + [ 'fill' => Color::get_css( isset( $attributes['iconPrimaryColorH'] ) ? $attributes['iconPrimaryColorH'] : '' ) ], | |
| 740 | + Range::get_css([ | |
| 741 | + 'attributeValue' => $attributes['iconTransition'], | |
| 742 | + 'attribute_object_key' => 'value', | |
| 743 | + 'defaultValue' => 0, | |
| 744 | + 'unitDefaultValue' => 's', | |
| 745 | + 'property' => 'transition-duration', | |
| 746 | + 'device' => $device, | |
| 747 | + ]), | |
| 748 | + $css | |
| 749 | + ); | |
| 750 | + } | |
| 751 | + public function get_icon_css_background_hover( $attributes, $device = '' ) { | |
| 752 | + $css = []; | |
| 753 | + if ( ! empty( $attributes['iconBackgroundColorH'] ) ) { | |
| 754 | + $css['background'] = $attributes['iconBackgroundColorH']; | |
| 373 | 755 | } |
| 374 | 756 | return array_merge( |
| 375 | 757 | Range::get_css([ |
| 376 | 758 | 'attributeValue' => $attributes['iconTransition'], |
| @@ -406,9 +788,10 @@ | ||
| 406 | 788 | ); |
| 407 | 789 | } |
| 408 | 790 | |
| 409 | 791 | public function get_heading_text_css( $attributes, $device = '' ) { |
| 410 | - $typography_css = ! empty( $attributes['headingTypography'] ) ? Typography::get_css( $attributes['headingTypography'], '', $device ) : array(); | |
| 792 | + $typographyGlobal = ! empty( $attributes['headingTypographyGlobal'] ) ? $attributes['headingTypographyGlobal'] : array(); | |
| 793 | + $typography_css = ! empty( $attributes['headingTypography'] ) ? Typography::get_css( $attributes['headingTypography'], '', $device, $typographyGlobal ) : array(); | |
| 411 | 794 | $textShadowCss = ! empty( $attributes['headingTextShadow'] ) ? TextShadow::get_css( $attributes['headingTextShadow'], '', $device ) : array(); |
| 412 | 795 | $textStrokeCss = ! empty( $attributes['headingTextStroke'] ) ? TextStroke::get_css( $attributes['headingTextStroke'], '', $device ) : array(); |
| 413 | 796 | |
| 414 | 797 | $css = []; |
| @@ -422,20 +805,25 @@ | ||
| 422 | 805 | $css['text-align'] = $attributes['alignment'][ 'value' . $device ]; |
| 423 | 806 | } |
| 424 | 807 | } |
| 425 | 808 | |
| 426 | - return array_merge( $css, $typography_css, $textShadowCss, $textStrokeCss ); | |
| 809 | + return array_merge( | |
| 810 | + $css, | |
| 811 | + $typography_css, | |
| 812 | + $textShadowCss, | |
| 813 | + $textStrokeCss, | |
| 814 | + [ 'color' => Color::get_css( isset( $attributes['headingTextColor'] ) ? $attributes['headingTextColor'] : '' ) ], | |
| 815 | + Dimensions::get_css( $attributes['headingMargin'], 'margin', $device ), | |
| 816 | + ); | |
| 427 | 817 | } |
| 428 | 818 | public function get_heading_text_css_hover( $attributes, $device = '' ) { |
| 429 | 819 | $css = []; |
| 430 | - if ( ! empty( $attributes['headingTextColorHover'] ) ) { | |
| 431 | - $css['color'] = $attributes['headingTextColorHover']; | |
| 432 | - } | |
| 433 | 820 | if ( ! empty( $attributes['headingTransition'] ) ) { |
| 434 | 821 | $css['transition-duration'] = $attributes['headingTransition'] . 's'; |
| 435 | 822 | } |
| 436 | 823 | |
| 437 | 824 | return array_merge( |
| 825 | + [ 'color' => Color::get_css( isset( $attributes['headingTextColorHover'] ) ? $attributes['headingTextColorHover'] : '' ) ], | |
| 438 | 826 | Range::get_css([ |
| 439 | 827 | 'attributeValue' => $attributes['headingTransition'], |
| 440 | 828 | 'attribute_object_key' => 'value', |
| 441 | 829 | 'defaultValue' => 0, |
| @@ -448,9 +836,10 @@ | ||
| 448 | 836 | } |
| 449 | 837 | |
| 450 | 838 | |
| 451 | 839 | public function get_sub_heading_text_css( $attributes, $device = '' ) { |
| 452 | - $typography_css = ! empty( $attributes['subHeadingTypography'] ) ? Typography::get_css( $attributes['subHeadingTypography'], '', $device ) : array(); | |
| 840 | + $typographyGlobal = ! empty( $attributes['subHeadingTypographyGlobal'] ) ? $attributes['subHeadingTypographyGlobal'] : array(); | |
| 841 | + $typography_css = ! empty( $attributes['subHeadingTypography'] ) ? Typography::get_css( $attributes['subHeadingTypography'], '', $device, $typographyGlobal ) : array(); | |
| 453 | 842 | $textShadowCss = ! empty( $attributes['subHeadingTextShadow'] ) ? TextShadow::get_css( $attributes['subHeadingTextShadow'], '', $device ) : array(); |
| 454 | 843 | $textStrokeCss = ! empty( $attributes['subHeadingTextStroke'] ) ? TextStroke::get_css( $attributes['subHeadingTextStroke'], '', $device ) : array(); |
| 455 | 844 | |
| 456 | 845 | $css = []; |
| @@ -464,16 +853,21 @@ | ||
| 464 | 853 | $css['text-align'] = $attributes['alignment'][ 'value' . $device ]; |
| 465 | 854 | } |
| 466 | 855 | } |
| 467 | 856 | |
| 468 | - return array_merge( $css, $typography_css, $textShadowCss, $textStrokeCss ); | |
| 857 | + return array_merge( | |
| 858 | + $css, | |
| 859 | + $typography_css, | |
| 860 | + $textShadowCss, | |
| 861 | + $textStrokeCss, | |
| 862 | + [ 'color' => Color::get_css( isset( $attributes['subHeadingTextColor'] ) ? $attributes['subHeadingTextColor'] : '' ) ], | |
| 863 | + Dimensions::get_css( $attributes['subHeadingMargin'], 'margin', $device ), | |
| 864 | + ); | |
| 469 | 865 | } |
| 470 | 866 | public function get_sub_heading_text_css_hover( $attributes, $device = '' ) { |
| 471 | 867 | $css = []; |
| 472 | - if ( ! empty( $attributes['subHeadingTextColorHover'] ) ) { | |
| 473 | - $css['color'] = $attributes['subHeadingTextColorHover']; | |
| 474 | - } | |
| 475 | 868 | return array_merge( |
| 869 | + [ 'color' => Color::get_css( isset( $attributes['subHeadingTextColorHover'] ) ? $attributes['subHeadingTextColorHover'] : '' ) ], | |
| 476 | 870 | Range::get_css([ |
| 477 | 871 | 'attributeValue' => $attributes['subHeadingTransition'], |
| 478 | 872 | 'attribute_object_key' => 'value', |
| 479 | 873 | 'defaultValue' => 0, |
| @@ -496,21 +890,22 @@ | ||
| 496 | 890 | } else { |
| 497 | 891 | $css['text-align'] = $attributes['alignment'][ 'value' . $device ]; |
| 498 | 892 | } |
| 499 | 893 | } |
| 894 | + $typographyGlobal = ! empty( $attributes['desTypographyGlobal'] ) ? $attributes['desTypographyGlobal'] : array(); | |
| 500 | 895 | return array_merge( |
| 501 | 896 | $css, |
| 502 | - isset( $attributes['desTypography'] ) ? Typography::get_css( $attributes['desTypography'], '', $device ) : [], | |
| 897 | + [ 'color' => Color::get_css( isset( $attributes['desTextColor'] ) ? $attributes['desTextColor'] : '' ) ], | |
| 898 | + isset( $attributes['desTypography'] ) ? Typography::get_css( $attributes['desTypography'], '', $device, $typographyGlobal ) : [], | |
| 503 | 899 | isset( $attributes['desTextStroke'] ) ? TextStroke::get_css( $attributes['desTextStroke'], '', $device ) : [], |
| 504 | 900 | isset( $attributes['desTextShadow'] ) ? TextShadow::get_css( $attributes['desTextShadow'], '', $device ) : [], |
| 901 | + Dimensions::get_css( $attributes['desMargin'], 'margin', $device ), | |
| 505 | 902 | ); |
| 506 | 903 | } |
| 507 | 904 | public function get_des_text_css_hover( $attributes, $device = '' ) { |
| 508 | 905 | $css = []; |
| 509 | - if ( ! empty( $attributes['desTextColorHover'] ) ) { | |
| 510 | - $css['color'] = $attributes['desTextColorHover']; | |
| 511 | - } | |
| 512 | 906 | return array_merge( |
| 907 | + [ 'color' => Color::get_css( isset( $attributes['desTextColorHover'] ) ? $attributes['desTextColorHover'] : '' ) ], | |
| 513 | 908 | Range::get_css([ |
| 514 | 909 | 'attributeValue' => $attributes['desTransition'], |
| 515 | 910 | 'attribute_object_key' => 'value', |
| 516 | 911 | 'defaultValue' => 0, |
| @@ -523,9 +918,10 @@ | ||
| 523 | 918 | } |
| 524 | 919 | public function get_des_drop_text_css( $attributes, $device = '' ) { |
| 525 | 920 | $css = []; |
| 526 | 921 | if ( ! empty( $attributes['desDropCapsTextColor'] ) ) { |
| 527 | - $css['color'] = $attributes['desDropCapsTextColor']; | |
| 922 | + $css['color'] = Color::get_css( | |
| 923 | + isset( $attributes['desDropCapsTextColor'] ) ? $attributes['desDropCapsTextColor'] : ''); | |
| 528 | 924 | } |
| 529 | 925 | return $css; |
| 530 | 926 | } |
| 531 | 927 | |
| @@ -549,9 +945,11 @@ | ||
| 549 | 945 | } |
| 550 | 946 | public function get_rating_number_css( $attributes, $device = '' ) { |
| 551 | 947 | $css = []; |
| 552 | 948 | if ( ! empty( $attributes['ratingNumberColor'] ) ) { |
| 553 | - $css['color'] = $attributes['ratingNumberColor']; | |
| 949 | + $css['color'] = Color::get_css( | |
| 950 | + isset( $attributes['ratingNumberColor'] ) ? $attributes['ratingNumberColor'] : ''); | |
| 951 | + | |
| 554 | 952 | } |
| 555 | 953 | if ( ! empty( $attributes['ratingNumberPosition'] ) ) { |
| 556 | 954 | if ( 'left' === $attributes['ratingNumberPosition'] ) { |
| 557 | 955 | $css['order'] = '-5'; |
| @@ -558,27 +956,19 @@ | ||
| 558 | 956 | } else { |
| 559 | 957 | $css['order'] = '10'; |
| 560 | 958 | } |
| 561 | 959 | } |
| 960 | + $typographyGlobal = ! empty( $attributes['ratingNumberTypographyGlobal'] ) ? $attributes['ratingNumberTypographyGlobal'] : array(); | |
| 562 | 961 | return array_merge( |
| 563 | 962 | $css, |
| 564 | - isset( $attributes['ratingNumberTypography'] ) ? Typography::get_css( $attributes['ratingNumberTypography'], '', $device ) : [], | |
| 963 | + isset( $attributes['ratingNumberTypography'] ) ? Typography::get_css( $attributes['ratingNumberTypography'], '', $device, $typographyGlobal ) : [], | |
| 565 | 964 | ); |
| 566 | 965 | } |
| 567 | 966 | public function get_rating_css( $attributes, $device = '' ) { |
| 568 | 967 | $rating_css = []; |
| 569 | 968 | return array_merge( |
| 570 | - Range::get_css([ | |
| 571 | - 'attributeValue' => $attributes['size'] ?? [], | |
| 572 | - 'attribute_object_key' => 'value', | |
| 573 | - 'isResponsive' => true, | |
| 574 | - 'defaultValue' => 0, | |
| 575 | - 'hasUnit' => true, | |
| 576 | - 'unitDefaultValue' => 'px', | |
| 577 | - 'property' => 'font-size', | |
| 578 | - 'device' => $device, | |
| 579 | - ]), | |
| 580 | 969 | $rating_css, |
| 970 | + Dimensions::get_css( $attributes['ratingMargin'], 'margin', $device ), | |
| 581 | 971 | ); |
| 582 | 972 | } |
| 583 | 973 | |
| 584 | 974 | |
| @@ -601,13 +991,10 @@ | ||
| 601 | 991 | } |
| 602 | 992 | |
| 603 | 993 | public function get_fill_rating_css( $attributes, $device = '' ) { |
| 604 | 994 | $css = []; |
| 605 | - if ( ! empty( $attributes['ratingColor'] ) ) { | |
| 606 | - $css['fill'] = $attributes['ratingColor']; | |
| 607 | - } | |
| 608 | - | |
| 609 | 995 | return array_merge( |
| 996 | + [ 'fill' => Color::get_css( isset( $attributes['ratingColor'] ) ? $attributes['ratingColor'] : '' ) ], | |
| 610 | 997 | Range::get_css([ |
| 611 | 998 | 'attributeValue' => $attributes['ratingTransition'], |
| 612 | 999 | 'attribute_object_key' => 'value', |
| 613 | 1000 | 'defaultValue' => 0, |
| @@ -620,9 +1007,10 @@ | ||
| 620 | 1007 | } |
| 621 | 1008 | public function get_unfill_rating_css( $attributes, $device = '' ) { |
| 622 | 1009 | $css = []; |
| 623 | 1010 | if ( ! empty( $attributes['ratingColor'] ) ) { |
| 624 | - $css['fill'] = $attributes['ratingUnmarkedColor']; | |
| 1011 | + $css['fill'] = Color::get_css( | |
| 1012 | + isset( $attributes['ratingUnmarkedColor'] ) ? $attributes['ratingUnmarkedColor'] : ''); | |
| 625 | 1013 | } |
| 626 | 1014 | return array_merge( |
| 627 | 1015 | Range::get_css([ |
| 628 | 1016 | 'attributeValue' => $attributes['ratingTransition'], |
| @@ -636,13 +1024,10 @@ | ||
| 636 | 1024 | ); |
| 637 | 1025 | } |
| 638 | 1026 | public function get_fill_rating_css_hover( $attributes, $device = '' ) { |
| 639 | 1027 | $css = []; |
| 640 | - if ( ! empty( $attributes['ratingColorHover'] ) ) { | |
| 641 | - $css['fill'] = $attributes['ratingColorHover']; | |
| 642 | - } | |
| 643 | - | |
| 644 | 1028 | return array_merge( |
| 1029 | + [ 'fill' => Color::get_css( isset( $attributes['ratingColorHover'] ) ? $attributes['ratingColorHover'] : '' ) ], | |
| 645 | 1030 | Range::get_css([ |
| 646 | 1031 | 'attributeValue' => $attributes['ratingTransition'], |
| 647 | 1032 | 'attribute_object_key' => 'value', |
| 648 | 1033 | 'defaultValue' => 0, |
| @@ -655,9 +1040,10 @@ | ||
| 655 | 1040 | } |
| 656 | 1041 | public function get_unfill_rating_css_hover( $attributes, $device = '' ) { |
| 657 | 1042 | $css = []; |
| 658 | 1043 | if ( ! empty( $attributes['ratingColorHover'] ) ) { |
| 659 | - $css['fill'] = $attributes['ratingUnmarkedColorHover']; | |
| 1044 | + $css['fill'] = Color::get_css( | |
| 1045 | + isset( $attributes['ratingUnmarkedColorHover'] ) ? $attributes['ratingUnmarkedColorHover'] : ''); | |
| 660 | 1046 | } |
| 661 | 1047 | return array_merge( |
| 662 | 1048 | Range::get_css([ |
| 663 | 1049 | 'attributeValue' => $attributes['ratingTransition'], |
| @@ -674,9 +1060,10 @@ | ||
| 674 | 1060 | public function get_button_css( $attributes, $device = '' ) { |
| 675 | 1061 | $css = []; |
| 676 | 1062 | |
| 677 | 1063 | if ( ! empty( $attributes['btnBackground'] ) ) { |
| 678 | - $css['background'] = $attributes['btnBackground']; | |
| 1064 | + $css['background'] = Color::get_css( | |
| 1065 | + isset( $attributes['btnBackground'] ) ? $attributes['btnBackground'] : ''); | |
| 679 | 1066 | } else { |
| 680 | 1067 | $css['background'] = $attributes['btnType']; |
| 681 | 1068 | } |
| 682 | 1069 | |
| @@ -682,8 +1069,9 @@ | ||
| 682 | 1069 | |
| 683 | 1070 | if ( isset( $attributes['btnAlignment'][ 'value' . $device ] ) ) { |
| 684 | 1071 | $css['justify-content'] = $attributes['btnAlignment'][ 'value' . $device ]; |
| 685 | 1072 | } |
| 1073 | + $typographyGlobal = ! empty( $attributes['btnTypographyGlobal'] ) ? $attributes['btnTypographyGlobal'] : array(); | |
| 686 | 1074 | |
| 687 | 1075 | return array_merge( |
| 688 | 1076 | Range::get_css([ |
| 689 | 1077 | 'attributeValue' => $attributes['btnIconSpace'], |
| @@ -700,26 +1088,21 @@ | ||
| 700 | 1088 | 'property' => 'transition-duration', |
| 701 | 1089 | 'device' => $device, |
| 702 | 1090 | ]), |
| 703 | 1091 | $css, |
| 704 | - [ 'color' => $attributes['btnTextColor'] ?? '#000000' ], | |
| 1092 | + [ 'color' => Color::get_css( isset( $attributes['btnTextColor'] ) ? $attributes['btnTextColor'] : '' ) ], | |
| 705 | 1093 | Border::get_css( $attributes['btnBorder'], '', $device ), |
| 706 | - Typography::get_css( $attributes['btnTypography'], '', $device ), | |
| 1094 | + Typography::get_css( $attributes['btnTypography'], '', $device, $typographyGlobal ), | |
| 707 | 1095 | Dimensions::get_css( $attributes['btnPadding'], 'padding', $device ), |
| 1096 | + Dimensions::get_css( $attributes['btnMargin'], 'margin', $device ), | |
| 708 | 1097 | ); |
| 709 | 1098 | } |
| 710 | 1099 | public function get_button_hover_css( $attributes, $device = '' ) { |
| 711 | 1100 | $css = []; |
| 712 | - if ( ! empty( $attributes['btnTextColorH'] ) ) { | |
| 713 | - $css['color'] = $attributes['btnTextColorH']; | |
| 714 | - } | |
| 715 | - | |
| 716 | - if ( ! empty( $attributes['btnBackgroundH'] ) ) { | |
| 717 | - $css['background'] = $attributes['btnBackgroundH']; | |
| 718 | - } | |
| 719 | - | |
| 720 | 1101 | return array_merge( |
| 721 | 1102 | $css, |
| 1103 | + [ 'color' => Color::get_css( isset( $attributes['btnTextColorH'] ) ? $attributes['btnTextColorH'] : '' ) ], | |
| 1104 | + [ 'background' => Color::get_css( isset( $attributes['btnBackgroundH'] ) ? $attributes['btnBackgroundH'] : '' ) ], | |
| 722 | 1105 | Border::get_hover_css( $attributes['btnBorder'], '', $device ) |
| 723 | 1106 | ); |
| 724 | 1107 | } |
| 725 | 1108 | public function get_button_text_css( $attributes, $device = '' ) { |
| @@ -725,13 +1108,7 @@ | ||
| 725 | 1108 | public function get_button_text_css( $attributes, $device = '' ) { |
| 726 | 1109 | return TextShadow::get_css( $attributes['btnTextShadow'] ); |
| 727 | 1110 | } |
| 728 | 1111 | public function get_button_icon_hover_css( $attributes, $device = '' ) { |
| 729 | - $css = []; | |
| 730 | - | |
| 731 | - if ( ! empty( $attributes['btnTextColorH'] ) ) { | |
| 732 | - $css['fill'] = $attributes['btnTextColorH']; | |
| 733 | - } | |
| 734 | - | |
| 735 | - return $css; | |
| 1112 | + return [ 'fill' => Color::get_css( isset( $attributes['btnTextColorH'] ) ? $attributes['btnTextColorH'] : '' ) ]; | |
| 736 | 1113 | } |
| 737 | 1114 | } |