← All changes
|
app/Elementor/Widgets/Controls/ModuleBtnControls.php
+354
-366
2.2.2
→
1.0.0
View file →
| @@ -1,366 +1,354 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Main ProductDescription class. | |
| 4 | - * | |
| 5 | - * @package RadiusTheme\SB | |
| 6 | - */ | |
| 7 | - | |
| 8 | -namespace RadiusTheme\SB\Elementor\Widgets\Controls; | |
| 9 | - | |
| 10 | -use Elementor\Controls_Manager; | |
| 11 | -use RadiusTheme\SB\Helpers\Fns; | |
| 12 | - | |
| 13 | -// Do not allow directly accessing this file. | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | - exit( 'This script cannot be accessed directly.' ); | |
| 16 | -} | |
| 17 | - | |
| 18 | -/** | |
| 19 | - * Product Description class | |
| 20 | - */ | |
| 21 | -class ModuleBtnControls { | |
| 22 | - /** | |
| 23 | - * Widget Field | |
| 24 | - * | |
| 25 | - * @param object $widget Widget Object. | |
| 26 | - * | |
| 27 | - * @return array | |
| 28 | - */ | |
| 29 | - public static function module_button_style( $widget ) { | |
| 30 | - $selector = $widget->selectors; | |
| 31 | - $module_btn_active = Fns::is_module_active( 'wishlist' ) || Fns::is_module_active( 'compare' ) || Fns::is_module_active( 'quick_view' ); | |
| 32 | - $fields = []; | |
| 33 | - if ( ! $module_btn_active ) { | |
| 34 | - return $fields; | |
| 35 | - } | |
| 36 | - | |
| 37 | - $fields = [ | |
| 38 | - 'module_section' => [ | |
| 39 | - 'mode' => 'section_start', | |
| 40 | - 'tab' => 'style', | |
| 41 | - 'label' => esc_html__( 'Wishlist, Compare & Quick view', 'shopbuilder' ), | |
| 42 | - 'conditions' => [ | |
| 43 | - 'relation' => 'or', | |
| 44 | - 'terms' => [], | |
| 45 | - ], | |
| 46 | - ], | |
| 47 | - 'module_width' => [ | |
| 48 | - 'label' => esc_html__( 'Width', 'shopbuilder' ), | |
| 49 | - 'type' => 'slider', | |
| 50 | - 'separator' => 'default', | |
| 51 | - 'range' => [ | |
| 52 | - 'px' => [ | |
| 53 | - 'min' => 10, | |
| 54 | - 'max' => 200, | |
| 55 | - ], | |
| 56 | - ], | |
| 57 | - 'default' => [ | |
| 58 | - 'size' => 20, | |
| 59 | - ], | |
| 60 | - 'selectors' => [ | |
| 61 | - $selector['module_width'] => 'width: {{SIZE}}{{UNIT}};', | |
| 62 | - ], | |
| 63 | - ], | |
| 64 | - 'module_height' => [ | |
| 65 | - 'label' => esc_html__( 'Height', 'shopbuilder' ), | |
| 66 | - 'type' => 'slider', | |
| 67 | - 'range' => [ | |
| 68 | - 'px' => [ | |
| 69 | - 'min' => 10, | |
| 70 | - 'max' => 200, | |
| 71 | - ], | |
| 72 | - ], | |
| 73 | - 'default' => [ | |
| 74 | - 'size' => 20, | |
| 75 | - ], | |
| 76 | - 'selectors' => [ | |
| 77 | - $selector['module_height'] => 'height: {{SIZE}}{{UNIT}};', | |
| 78 | - ], | |
| 79 | - ], | |
| 80 | - 'module_item_gap' => [ | |
| 81 | - 'label' => esc_html__( 'Item Gap (px)', 'shopbuilder' ), | |
| 82 | - 'type' => 'slider', | |
| 83 | - 'separator' => 'default', | |
| 84 | - 'range' => [ | |
| 85 | - 'px' => [ | |
| 86 | - 'min' => 0, | |
| 87 | - 'max' => 100, | |
| 88 | - ], | |
| 89 | - ], | |
| 90 | - 'default' => [ | |
| 91 | - 'size' => 5, | |
| 92 | - ], | |
| 93 | - 'selectors' => [ | |
| 94 | - $selector['module_item_gap'] => 'gap: {{SIZE}}{{UNIT}};', | |
| 95 | - ], | |
| 96 | - ], | |
| 97 | - 'module_item_alignment' => [ | |
| 98 | - 'mode' => 'responsive', | |
| 99 | - 'type' => 'choose', | |
| 100 | - 'label' => esc_html__( 'Elements Alignment', 'shopbuilder' ), | |
| 101 | - 'options' => [ | |
| 102 | - 'left' => [ | |
| 103 | - 'title' => esc_html__( 'Left', 'shopbuilder' ), | |
| 104 | - 'icon' => 'eicon-text-align-left', | |
| 105 | - ], | |
| 106 | - 'center' => [ | |
| 107 | - 'title' => esc_html__( 'Center', 'shopbuilder' ), | |
| 108 | - 'icon' => 'eicon-text-align-center', | |
| 109 | - ], | |
| 110 | - 'right' => [ | |
| 111 | - 'title' => esc_html__( 'Right', 'shopbuilder' ), | |
| 112 | - 'icon' => 'eicon-text-align-right', | |
| 113 | - ], | |
| 114 | - ], | |
| 115 | - 'selectors' => [ | |
| 116 | - $selector['module_item_alignment'] => 'justify-content: {{VALUE}}!important;', | |
| 117 | - ], | |
| 118 | - ], | |
| 119 | - 'module_tabs_start' => [ | |
| 120 | - 'mode' => 'tabs_start', | |
| 121 | - ], | |
| 122 | - // Tab For normal view. | |
| 123 | - 'module_normal' => [ | |
| 124 | - 'mode' => 'tab_start', | |
| 125 | - 'label' => esc_html__( 'Normal', 'shopbuilder' ), | |
| 126 | - ], | |
| 127 | - 'module_text_color_normal' => [ | |
| 128 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 129 | - 'type' => 'color', | |
| 130 | - 'separator' => 'default', | |
| 131 | - 'selectors' => [ | |
| 132 | - $selector['module_text_color_normal'] => 'color: {{VALUE}};', | |
| 133 | - ], | |
| 134 | - ], | |
| 135 | - 'module_bg_color_normal' => [ | |
| 136 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 137 | - 'type' => 'color', | |
| 138 | - | |
| 139 | - 'selectors' => [ | |
| 140 | - $selector['module_bg_color_normal'] => 'background-color: {{VALUE}};', | |
| 141 | - ], | |
| 142 | - ], | |
| 143 | - | |
| 144 | - 'module_border' => [ | |
| 145 | - 'mode' => 'group', | |
| 146 | - 'type' => 'border', | |
| 147 | - 'selector' => $selector['module_border'], | |
| 148 | - 'size_units' => [ 'px' ], | |
| 149 | - ], | |
| 150 | - 'module_normal_end' => [ | |
| 151 | - 'mode' => 'tab_end', | |
| 152 | - ], | |
| 153 | - 'module_hover' => [ | |
| 154 | - 'mode' => 'tab_start', | |
| 155 | - 'label' => esc_html__( 'Hover', 'shopbuilder' ), | |
| 156 | - ], | |
| 157 | - 'module_text_color_hover' => [ | |
| 158 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 159 | - 'type' => 'color', | |
| 160 | - | |
| 161 | - 'separator' => 'default', | |
| 162 | - 'selectors' => [ | |
| 163 | - $selector['module_text_color_hover'] => 'color: {{VALUE}};', | |
| 164 | - ], | |
| 165 | - ], | |
| 166 | - 'module_bg_color_hover' => [ | |
| 167 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 168 | - 'type' => 'color', | |
| 169 | - | |
| 170 | - 'selectors' => [ | |
| 171 | - $selector['module_bg_color_hover'] => 'background-color: {{VALUE}};', | |
| 172 | - ], | |
| 173 | - ], | |
| 174 | - 'module_border_hover_color' => [ | |
| 175 | - 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 176 | - 'type' => 'color', | |
| 177 | - | |
| 178 | - 'selectors' => [ | |
| 179 | - $selector['module_border_hover_color'] => 'border-color: {{VALUE}};', | |
| 180 | - ], | |
| 181 | - ], | |
| 182 | - 'module_hover_end' => [ | |
| 183 | - 'mode' => 'tab_end', | |
| 184 | - ], | |
| 185 | - 'module_tabs_end' => [ | |
| 186 | - 'mode' => 'tabs_end', | |
| 187 | - ], | |
| 188 | - 'module_border_radius' => [ | |
| 189 | - 'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), | |
| 190 | - 'type' => 'dimensions', | |
| 191 | - 'mode' => 'responsive', | |
| 192 | - 'separator' => 'before', | |
| 193 | - 'size_units' => [ 'px' ], | |
| 194 | - 'selectors' => [ | |
| 195 | - $selector['module_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 196 | - ], | |
| 197 | - ], | |
| 198 | - | |
| 199 | - 'icon_size' => [ | |
| 200 | - 'label' => esc_html__( 'Icon Size', 'shopbuilder' ), | |
| 201 | - 'type' => 'slider', | |
| 202 | - 'separator' => 'before', | |
| 203 | - 'range' => [ | |
| 204 | - 'px' => [ | |
| 205 | - 'min' => 10, | |
| 206 | - 'max' => 200, | |
| 207 | - ], | |
| 208 | - ], | |
| 209 | - 'default' => [ | |
| 210 | - 'size' => 15, | |
| 211 | - ], | |
| 212 | - 'selectors' => [ | |
| 213 | - $selector['icon_size']['icon'] => 'font-size: {{SIZE}}{{UNIT}};', | |
| 214 | - $selector['icon_size']['svg'] => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', | |
| 215 | - ], | |
| 216 | - ], | |
| 217 | - 'module_wrapper_margin' => [ | |
| 218 | - 'label' => esc_html__( 'Module Wrapper Gap (px)', 'shopbuilder' ), | |
| 219 | - 'type' => 'dimensions', | |
| 220 | - 'mode' => 'responsive', | |
| 221 | - 'size_units' => [ 'px' ], | |
| 222 | - 'selectors' => [ | |
| 223 | - $selector['module_wrapper_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 224 | - ], | |
| 225 | - ], | |
| 226 | - 'module_section_end' => [ | |
| 227 | - 'mode' => 'section_end', | |
| 228 | - ], | |
| 229 | - ]; | |
| 230 | - | |
| 231 | - if ( Fns::is_module_active( 'wishlist' ) ) { | |
| 232 | - $fields['module_section']['conditions']['terms'][] = [ | |
| 233 | - 'name' => 'wishlist_button', | |
| 234 | - 'operator' => '===', | |
| 235 | - 'value' => 'yes', | |
| 236 | - ]; | |
| 237 | - } | |
| 238 | - if ( Fns::is_module_active( 'compare' ) ) { | |
| 239 | - $fields['module_section']['conditions']['terms'][] = [ | |
| 240 | - 'name' => 'comparison_button', | |
| 241 | - 'operator' => '===', | |
| 242 | - 'value' => 'yes', | |
| 243 | - ]; | |
| 244 | - } | |
| 245 | - if ( Fns::is_module_active( 'quick_view' ) ) { | |
| 246 | - $fields['module_section']['conditions']['terms'][] = [ | |
| 247 | - 'name' => 'quick_view_button', | |
| 248 | - 'operator' => '===', | |
| 249 | - 'value' => 'yes', | |
| 250 | - ]; | |
| 251 | - } | |
| 252 | - | |
| 253 | - return $fields; | |
| 254 | - } | |
| 255 | - | |
| 256 | - /** | |
| 257 | - * Widget Field | |
| 258 | - * | |
| 259 | - * @return array | |
| 260 | - */ | |
| 261 | - public static function module_switch() { | |
| 262 | - $fields = []; | |
| 263 | - if ( Fns::is_module_active( 'wishlist' ) ) { | |
| 264 | - $fields['wishlist_button'] = [ | |
| 265 | - 'type' => 'switch', | |
| 266 | - 'label' => esc_html__( 'Show Wishlist Button?', 'shopbuilder' ), | |
| 267 | - 'description' => esc_html__( 'Switch on to show product wishlist.', 'shopbuilder' ), | |
| 268 | - 'default' => 'yes', | |
| 269 | - ]; | |
| 270 | - } | |
| 271 | - if ( Fns::is_module_active( 'compare' ) ) { | |
| 272 | - $fields['comparison_button'] = [ | |
| 273 | - 'type' => 'switch', | |
| 274 | - 'label' => esc_html__( 'Show Compare Button?', 'shopbuilder' ), | |
| 275 | - 'description' => esc_html__( 'Switch on to show product comparison.', 'shopbuilder' ), | |
| 276 | - 'default' => 'yes', | |
| 277 | - ]; | |
| 278 | - } | |
| 279 | - if ( Fns::is_module_active( 'quick_view' ) ) { | |
| 280 | - $fields['quick_view_button'] = [ | |
| 281 | - 'type' => 'switch', | |
| 282 | - 'label' => esc_html__( 'Show Quick View Button?', 'shopbuilder' ), | |
| 283 | - 'description' => esc_html__( 'Switch on to show product quick view.', 'shopbuilder' ), | |
| 284 | - 'default' => 'yes', | |
| 285 | - ]; | |
| 286 | - } | |
| 287 | - | |
| 288 | - return $fields; | |
| 289 | - } | |
| 290 | - | |
| 291 | - /** | |
| 292 | - * Widget Field | |
| 293 | - * | |
| 294 | - * @return array | |
| 295 | - */ | |
| 296 | - public static function module_icons() { | |
| 297 | - $module_btn_active = Fns::is_module_active( 'wishlist' ) || Fns::is_module_active( 'compare' ) || Fns::is_module_active( 'quick_view' ); | |
| 298 | - $fields = []; | |
| 299 | - if ( $module_btn_active ) { | |
| 300 | - if ( Fns::is_module_active( 'wishlist' ) ) { | |
| 301 | - $fields['wishlist_icon'] = [ | |
| 302 | - 'label' => esc_html__( 'Wishlist Icon', 'shopbuilder' ), | |
| 303 | - 'type' => 'icons', | |
| 304 | - 'separator' => 'default', | |
| 305 | - 'default' => [ | |
| 306 | - 'value' => 'rtsb-icon rtsb-icon-heart-empty', | |
| 307 | - 'library' => 'rtsb-fonts', | |
| 308 | - ], | |
| 309 | - 'condition' => [ | |
| 310 | - 'wishlist_button' => 'yes', | |
| 311 | - ], | |
| 312 | - ]; | |
| 313 | - $fields['wishlist_icon_added'] = [ | |
| 314 | - 'label' => esc_html__( 'After Added Wishlist Icon', 'shopbuilder' ), | |
| 315 | - 'type' => 'icons', | |
| 316 | - 'default' => [ | |
| 317 | - 'value' => 'rtsb-icon rtsb-icon-heart', | |
| 318 | - 'library' => 'rtsb-fonts', | |
| 319 | - ], | |
| 320 | - 'condition' => [ | |
| 321 | - 'wishlist_button' => 'yes', | |
| 322 | - ], | |
| 323 | - ]; | |
| 324 | - } | |
| 325 | - if ( Fns::is_module_active( 'compare' ) ) { | |
| 326 | - $fields['comparison_icon'] = [ | |
| 327 | - 'label' => esc_html__( 'Compare Icon', 'shopbuilder' ), | |
| 328 | - 'type' => 'icons', | |
| 329 | - 'default' => [ | |
| 330 | - 'value' => 'rtsb-icon rtsb-icon-exchange', | |
| 331 | - 'library' => 'rtsb-fonts', | |
| 332 | - ], | |
| 333 | - 'condition' => [ | |
| 334 | - 'comparison_button' => 'yes', | |
| 335 | - ], | |
| 336 | - ]; | |
| 337 | - $fields['comparison_icon_added'] = [ | |
| 338 | - 'label' => esc_html__( 'After Added Compare Icon', 'shopbuilder' ), | |
| 339 | - 'type' => 'icons', | |
| 340 | - 'default' => [ | |
| 341 | - 'value' => 'rtsb-icon rtsb-icon-check', | |
| 342 | - 'library' => 'rtsb-fonts', | |
| 343 | - ], | |
| 344 | - 'condition' => [ | |
| 345 | - 'comparison_button' => 'yes', | |
| 346 | - ], | |
| 347 | - ]; | |
| 348 | - } | |
| 349 | - if ( Fns::is_module_active( 'quick_view' ) ) { | |
| 350 | - $fields['quick_view_icon'] = [ | |
| 351 | - 'label' => esc_html__( 'Quick View Icon', 'shopbuilder' ), | |
| 352 | - 'type' => 'icons', | |
| 353 | - 'default' => [ | |
| 354 | - 'value' => 'rtsb-icon rtsb-icon-eye', | |
| 355 | - 'library' => 'rtsb-fonts', | |
| 356 | - ], | |
| 357 | - 'condition' => [ | |
| 358 | - 'quick_view_button' => 'yes', | |
| 359 | - ], | |
| 360 | - ]; | |
| 361 | - } | |
| 362 | - } | |
| 363 | - | |
| 364 | - return $fields; | |
| 365 | - } | |
| 366 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Main ProductDescription class. | |
| 4 | + * | |
| 5 | + * @package RadiusTheme\SB | |
| 6 | + */ | |
| 7 | + | |
| 8 | +namespace RadiusTheme\SB\Elementor\Widgets\Controls; | |
| 9 | + | |
| 10 | +use Elementor\Controls_Manager; | |
| 11 | +use RadiusTheme\SB\Helpers\Fns; | |
| 12 | + | |
| 13 | +// Do not allow directly accessing this file. | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit( 'This script cannot be accessed directly.' ); | |
| 16 | +} | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Product Description class | |
| 20 | + */ | |
| 21 | +class ModuleBtnControls { | |
| 22 | + /** | |
| 23 | + * Widget Field | |
| 24 | + * | |
| 25 | + * @param object $widget Widget Object. | |
| 26 | + * @return array | |
| 27 | + */ | |
| 28 | + public static function module_button_style( $widget ) { | |
| 29 | + $selector = $widget->selectors; | |
| 30 | + $module_btn_active = Fns::is_module_active('wishlist') || Fns::is_module_active('compare') || Fns::is_module_active('quick_view'); | |
| 31 | + $fields = []; | |
| 32 | + if( $module_btn_active ) { | |
| 33 | + $fields = [ | |
| 34 | + 'module_section' => [ | |
| 35 | + 'mode' => 'section_start', | |
| 36 | + 'tab' => 'style', | |
| 37 | + 'label' => esc_html__('Wishlist, Compare & Quick view', 'shopbuilder'), | |
| 38 | + 'conditions' => [ | |
| 39 | + 'relation' => 'or', | |
| 40 | + 'terms' => [ | |
| 41 | + [ | |
| 42 | + 'name' => 'wishlist_button', | |
| 43 | + 'operator' => '===', | |
| 44 | + 'value' => 'yes', | |
| 45 | + ], | |
| 46 | + [ | |
| 47 | + 'name' => 'comparison_button', | |
| 48 | + 'operator' => '===', | |
| 49 | + 'value' => 'yes', | |
| 50 | + ], | |
| 51 | + [ | |
| 52 | + 'name' => 'quick_view_button', | |
| 53 | + 'operator' => '===', | |
| 54 | + 'value' => 'yes', | |
| 55 | + ], | |
| 56 | + ], | |
| 57 | + ], | |
| 58 | + ], | |
| 59 | + 'module_width' => [ | |
| 60 | + 'label' => esc_html__('Width', 'shopbuilder'), | |
| 61 | + 'type' => 'slider', | |
| 62 | + 'separator' => 'default', | |
| 63 | + 'range' => [ | |
| 64 | + 'px' => [ | |
| 65 | + 'min' => 10, | |
| 66 | + 'max' => 200, | |
| 67 | + ], | |
| 68 | + ], | |
| 69 | + 'default' => [ | |
| 70 | + 'size' => 20, | |
| 71 | + ], | |
| 72 | + 'selectors' => [ | |
| 73 | + $selector['module_width'] => 'width: {{SIZE}}{{UNIT}};', | |
| 74 | + ], | |
| 75 | + ], | |
| 76 | + 'module_height' => [ | |
| 77 | + 'label' => esc_html__('Height', 'shopbuilder'), | |
| 78 | + 'type' => 'slider', | |
| 79 | + 'range' => [ | |
| 80 | + 'px' => [ | |
| 81 | + 'min' => 10, | |
| 82 | + 'max' => 200, | |
| 83 | + ], | |
| 84 | + ], | |
| 85 | + 'default' => [ | |
| 86 | + 'size' => 20, | |
| 87 | + ], | |
| 88 | + 'selectors' => [ | |
| 89 | + $selector['module_height'] => 'height: {{SIZE}}{{UNIT}};', | |
| 90 | + ], | |
| 91 | + ], | |
| 92 | + 'module_item_gap' => [ | |
| 93 | + 'label' => esc_html__('Item Gap (px)', 'shopbuilder'), | |
| 94 | + 'type' => 'slider', | |
| 95 | + 'separator' => 'default', | |
| 96 | + 'range' => [ | |
| 97 | + 'px' => [ | |
| 98 | + 'min' => 0, | |
| 99 | + 'max' => 100, | |
| 100 | + ], | |
| 101 | + ], | |
| 102 | + 'default' => [ | |
| 103 | + 'size' => 5, | |
| 104 | + ], | |
| 105 | + 'selectors' => [ | |
| 106 | + $selector['module_item_gap'] => 'gap: {{SIZE}}{{UNIT}};', | |
| 107 | + ], | |
| 108 | + ], | |
| 109 | + 'module_item_alignment' => [ | |
| 110 | + 'mode' => 'responsive', | |
| 111 | + 'type' => 'choose', | |
| 112 | + 'label' => esc_html__( 'Elements Alignment', 'shopbuilder' ), | |
| 113 | + 'options' => [ | |
| 114 | + 'left' => [ | |
| 115 | + 'title' => esc_html__( 'Left', 'shopbuilder' ), | |
| 116 | + 'icon' => 'eicon-text-align-left', | |
| 117 | + ], | |
| 118 | + 'center' => [ | |
| 119 | + 'title' => esc_html__( 'Center', 'shopbuilder' ), | |
| 120 | + 'icon' => 'eicon-text-align-center', | |
| 121 | + ], | |
| 122 | + 'right' => [ | |
| 123 | + 'title' => esc_html__( 'Right', 'shopbuilder' ), | |
| 124 | + 'icon' => 'eicon-text-align-right', | |
| 125 | + ], | |
| 126 | + ], | |
| 127 | + 'separator' => 'before-short elementor-control-separator-after', | |
| 128 | + 'selectors' => [ | |
| 129 | + $selector['module_item_alignment'] => 'justify-content: {{VALUE}};', | |
| 130 | + ], | |
| 131 | + ], | |
| 132 | + 'module_tabs_start' => [ | |
| 133 | + 'mode' => 'tabs_start', | |
| 134 | + ], | |
| 135 | + // Tab For normal view. | |
| 136 | + 'module_normal' => [ | |
| 137 | + 'mode' => 'tab_start', | |
| 138 | + 'label' => esc_html__('Normal', 'shopbuilder'), | |
| 139 | + ], | |
| 140 | + 'module_text_color_normal' => [ | |
| 141 | + 'label' => esc_html__('Color', 'shopbuilder'), | |
| 142 | + 'type' => 'color', | |
| 143 | + | |
| 144 | + 'separator' => 'default', | |
| 145 | + 'selectors' => [ | |
| 146 | + $selector['module_text_color_normal'] => 'color: {{VALUE}};', | |
| 147 | + ], | |
| 148 | + ], | |
| 149 | + 'module_bg_color_normal' => [ | |
| 150 | + 'label' => esc_html__('Background Color', 'shopbuilder'), | |
| 151 | + 'type' => 'color', | |
| 152 | + | |
| 153 | + 'selectors' => [ | |
| 154 | + $selector['module_bg_color_normal'] => 'background-color: {{VALUE}};', | |
| 155 | + ], | |
| 156 | + ], | |
| 157 | + | |
| 158 | + 'module_border' => [ | |
| 159 | + 'mode' => 'group', | |
| 160 | + 'type' => 'border', | |
| 161 | + 'selector' => $selector['module_border'], | |
| 162 | + 'size_units' => ['px'], | |
| 163 | + ], | |
| 164 | + 'module_normal_end' => [ | |
| 165 | + 'mode' => 'tab_end', | |
| 166 | + ], | |
| 167 | + 'module_hover' => [ | |
| 168 | + 'mode' => 'tab_start', | |
| 169 | + 'label' => esc_html__('Hover', 'shopbuilder'), | |
| 170 | + ], | |
| 171 | + 'module_text_color_hover' => [ | |
| 172 | + 'label' => esc_html__('Color', 'shopbuilder'), | |
| 173 | + 'type' => 'color', | |
| 174 | + | |
| 175 | + 'separator' => 'default', | |
| 176 | + 'selectors' => [ | |
| 177 | + $selector['module_text_color_hover'] => 'color: {{VALUE}};', | |
| 178 | + ], | |
| 179 | + ], | |
| 180 | + 'module_bg_color_hover' => [ | |
| 181 | + 'label' => esc_html__('Background Color', 'shopbuilder'), | |
| 182 | + 'type' => 'color', | |
| 183 | + | |
| 184 | + 'selectors' => [ | |
| 185 | + $selector['module_bg_color_hover'] => 'background-color: {{VALUE}};', | |
| 186 | + ], | |
| 187 | + ], | |
| 188 | + 'module_border_hover_color' => [ | |
| 189 | + 'label' => esc_html__('Border Color', 'shopbuilder'), | |
| 190 | + 'type' => 'color', | |
| 191 | + | |
| 192 | + 'selectors' => [ | |
| 193 | + $selector['module_border_hover_color'] => 'border-color: {{VALUE}};', | |
| 194 | + ], | |
| 195 | + ], | |
| 196 | + 'module_hover_end' => [ | |
| 197 | + 'mode' => 'tab_end', | |
| 198 | + ], | |
| 199 | + 'module_tabs_end' => [ | |
| 200 | + 'mode' => 'tabs_end', | |
| 201 | + ], | |
| 202 | + 'module_border_radius' => [ | |
| 203 | + 'label' => esc_html__('Border Radius (px)', 'shopbuilder'), | |
| 204 | + 'type' => 'dimensions', | |
| 205 | + 'separator' => 'before', | |
| 206 | + 'size_units' => ['px'], | |
| 207 | + 'selectors' => [ | |
| 208 | + $selector['module_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 209 | + ], | |
| 210 | + ], | |
| 211 | + | |
| 212 | + 'icon_size' => [ | |
| 213 | + 'label' => esc_html__('Icon Size', 'shopbuilder'), | |
| 214 | + 'type' => 'slider', | |
| 215 | + 'separator' => 'before', | |
| 216 | + 'range' => [ | |
| 217 | + 'px' => [ | |
| 218 | + 'min' => 10, | |
| 219 | + 'max' => 200, | |
| 220 | + ], | |
| 221 | + ], | |
| 222 | + 'default' => [ | |
| 223 | + 'size' => 15, | |
| 224 | + ], | |
| 225 | + 'selectors' => [ | |
| 226 | + $selector['icon_size'] => 'font-size: {{SIZE}}{{UNIT}};', | |
| 227 | + ], | |
| 228 | + ], | |
| 229 | + 'module_wrapper_margin' => [ | |
| 230 | + 'label' => esc_html__('Module Wrapper Gap (px)', 'shopbuilder'), | |
| 231 | + 'type' => 'dimensions', | |
| 232 | + 'size_units' => ['px'], | |
| 233 | + 'selectors' => [ | |
| 234 | + $selector['module_wrapper_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 235 | + ], | |
| 236 | + ], | |
| 237 | + 'module_section_end' => [ | |
| 238 | + 'mode' => 'section_end', | |
| 239 | + ], | |
| 240 | + ]; | |
| 241 | + } | |
| 242 | + return $fields; | |
| 243 | + } | |
| 244 | + /** | |
| 245 | + * Widget Field | |
| 246 | + * | |
| 247 | + * @return array | |
| 248 | + */ | |
| 249 | + public static function module_switch() | |
| 250 | + { | |
| 251 | + $fields = [] ; | |
| 252 | + if (Fns::is_module_active('wishlist')) { | |
| 253 | + $fields['wishlist_button'] = [ | |
| 254 | + 'type' => 'switch', | |
| 255 | + 'label' => esc_html__('Show Product Wishlist?', 'shopbuilder'), | |
| 256 | + 'description' => esc_html__('Switch on to show product wishlist.', 'shopbuilder'), | |
| 257 | + 'default' => 'yes', | |
| 258 | + ]; | |
| 259 | + } | |
| 260 | + if( Fns::is_module_active('compare') ){ | |
| 261 | + $fields['comparison_button'] = [ | |
| 262 | + 'type' => 'switch', | |
| 263 | + 'label' => esc_html__( 'Show Product Comparison?', 'shopbuilder' ), | |
| 264 | + 'description' => esc_html__( 'Switch on to show product comparison.', 'shopbuilder' ), | |
| 265 | + 'default' => 'yes', | |
| 266 | + ]; | |
| 267 | + } | |
| 268 | + if( Fns::is_module_active('quick_view') ) { | |
| 269 | + $fields['quick_view_button'] = [ | |
| 270 | + 'type' => 'switch', | |
| 271 | + 'label' => esc_html__('Show Product Quick View?', 'shopbuilder'), | |
| 272 | + 'description' => esc_html__('Switch on to show product quick view.', 'shopbuilder'), | |
| 273 | + 'default' => 'yes', | |
| 274 | + ]; | |
| 275 | + } | |
| 276 | + return $fields; | |
| 277 | + } | |
| 278 | + /** | |
| 279 | + * Widget Field | |
| 280 | + * | |
| 281 | + * @return array | |
| 282 | + */ | |
| 283 | + public static function module_icons() { | |
| 284 | + $module_btn_active = Fns::is_module_active('wishlist') || Fns::is_module_active('compare') || Fns::is_module_active('quick_view'); | |
| 285 | + $fields = []; | |
| 286 | + if( $module_btn_active ){ | |
| 287 | + if( Fns::is_module_active('wishlist') ){ | |
| 288 | + $fields['wishlist_icon'] = [ | |
| 289 | + 'label' => esc_html__( 'Wishlist Icon', 'shopbuilder' ), | |
| 290 | + 'type' => 'icons', | |
| 291 | + 'separator' => 'default', | |
| 292 | + 'default' => [ | |
| 293 | + 'value' => 'far fa-heart', | |
| 294 | + 'library' => 'fa-solid', | |
| 295 | + ], | |
| 296 | + 'condition' => [ | |
| 297 | + 'wishlist_button' => 'yes', | |
| 298 | + ], | |
| 299 | + ]; | |
| 300 | + $fields['wishlist_icon_added'] = [ | |
| 301 | + 'label' => esc_html__( 'After Added Wishlist Icon', 'shopbuilder' ), | |
| 302 | + 'type' => 'icons', | |
| 303 | + 'default' => [ | |
| 304 | + 'value' => 'fas fa-heart', | |
| 305 | + 'library' => 'fa-solid', | |
| 306 | + ], | |
| 307 | + 'condition' => [ | |
| 308 | + 'wishlist_button' => 'yes', | |
| 309 | + ], | |
| 310 | + ]; | |
| 311 | + } | |
| 312 | + if( Fns::is_module_active('compare') ){ | |
| 313 | + $fields['comparison_icon'] = [ | |
| 314 | + 'label' => esc_html__( 'Compare Icon', 'shopbuilder' ), | |
| 315 | + 'type' => 'icons', | |
| 316 | + 'default' => [ | |
| 317 | + 'value' => 'fas fa-compress', | |
| 318 | + 'library' => 'fa-solid', | |
| 319 | + ], | |
| 320 | + 'condition' => [ | |
| 321 | + 'comparison_button' => 'yes', | |
| 322 | + ], | |
| 323 | + ]; | |
| 324 | + $fields['comparison_icon_added'] = [ | |
| 325 | + 'label' => esc_html__( 'After Added Compare Icon', 'shopbuilder' ), | |
| 326 | + 'type' => 'icons', | |
| 327 | + 'default' => [ | |
| 328 | + 'value' => 'fas fa-check', | |
| 329 | + 'library' => 'fa-solid', | |
| 330 | + ], | |
| 331 | + 'condition' => [ | |
| 332 | + 'comparison_button' => 'yes', | |
| 333 | + ], | |
| 334 | + ]; | |
| 335 | + } | |
| 336 | + if( Fns::is_module_active('quick_view') ){ | |
| 337 | + $fields['quick_view_icon'] = [ | |
| 338 | + 'label' => esc_html__( 'Quick View Icon', 'shopbuilder' ), | |
| 339 | + 'type' => 'icons', | |
| 340 | + 'default' => [ | |
| 341 | + 'value' => 'far fa-eye', | |
| 342 | + 'library' => 'fa-solid', | |
| 343 | + ], | |
| 344 | + 'condition' => [ | |
| 345 | + 'quick_view_button' => 'yes', | |
| 346 | + ], | |
| 347 | + ]; | |
| 348 | + } | |
| 349 | + } | |
| 350 | + return $fields; | |
| 351 | + } | |
| 352 | + | |
| 353 | + | |
| 354 | +} | |