← All changes
|
app/Elementor/Widgets/Controls/ActionsBtnSettings.php
+113
-238
2.1.11
→
1.1.4
View file →
| @@ -1,238 +1,113 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Main ProductDescription class. | |
| 4 | - * | |
| 5 | - * @package RadiusTheme\SB | |
| 6 | - */ | |
| 7 | - | |
| 8 | -namespace RadiusTheme\SB\Elementor\Widgets\Controls; | |
| 9 | - | |
| 10 | -use RadiusTheme\SB\Helpers\Fns; | |
| 11 | - | |
| 12 | -// Do not allow directly accessing this file. | |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | - exit( 'This script cannot be accessed directly.' ); | |
| 15 | -} | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * Product Description class | |
| 19 | - */ | |
| 20 | -class ActionsBtnSettings { | |
| 21 | - /** | |
| 22 | - * Widget Field | |
| 23 | - * | |
| 24 | - * @return array | |
| 25 | - */ | |
| 26 | - public static function widget_fields( $widget ) { | |
| 27 | - return self::general_section() + | |
| 28 | - self::module_icons() + | |
| 29 | - self::module_button( $widget ) + | |
| 30 | - self::button_separator( $widget ); | |
| 31 | - } | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * Widget Field | |
| 35 | - * | |
| 36 | - * @return array | |
| 37 | - */ | |
| 38 | - public static function general_section() { | |
| 39 | - $fields = [ | |
| 40 | - 'sec_general' => [ | |
| 41 | - 'mode' => 'section_start', | |
| 42 | - 'label' => esc_html__( 'General', 'shopbuilder' ), | |
| 43 | - ], | |
| 44 | - 'view_mode' => [ | |
| 45 | - 'label' => esc_html__( 'Default View', 'shopbuilder' ), | |
| 46 | - 'type' => 'choose', | |
| 47 | - 'options' => [ | |
| 48 | - 'inline' => [ | |
| 49 | - 'title' => esc_html__( 'Inline', 'shopbuilder' ), | |
| 50 | - 'icon' => 'eicon-ellipsis-h', | |
| 51 | - ], | |
| 52 | - 'new-line' => [ | |
| 53 | - 'title' => esc_html__( 'New Line', 'shopbuilder' ), | |
| 54 | - 'icon' => 'eicon-post-list', | |
| 55 | - ], | |
| 56 | - ], | |
| 57 | - 'default' => 'inline', | |
| 58 | - ], | |
| 59 | - 'button_separator' => [ | |
| 60 | - 'label' => esc_html__( 'Button Separator', 'shopbuilder' ), | |
| 61 | - 'type' => 'text', | |
| 62 | - 'condition' => [ | |
| 63 | - 'view_mode' => 'inline', | |
| 64 | - ], | |
| 65 | - ], | |
| 66 | - 'general_style_end' => [ | |
| 67 | - 'mode' => 'section_end', | |
| 68 | - ], | |
| 69 | - ]; | |
| 70 | - $module_switch = ModuleBtnControls::module_switch(); | |
| 71 | - unset( $module_switch['quick_view_button'] ); | |
| 72 | - $fields = Fns::insert_controls( 'button_separator', $fields, $module_switch ); | |
| 73 | - | |
| 74 | - if ( Fns::is_module_active( 'wishlist' ) ) { | |
| 75 | - $wishlist_button = [ | |
| 76 | - 'wishlist_button_text' => [ | |
| 77 | - 'label' => esc_html__( 'Wishlist Text', 'shopbuilder' ), | |
| 78 | - 'type' => 'text', | |
| 79 | - 'condition' => [ | |
| 80 | - 'wishlist_button' => 'yes', | |
| 81 | - ], | |
| 82 | - ], | |
| 83 | - ]; | |
| 84 | - $fields = Fns::insert_controls( 'wishlist_button', $fields, $wishlist_button, true ); | |
| 85 | - } | |
| 86 | - if ( Fns::is_module_active( 'compare' ) ) { | |
| 87 | - $comparison_button = [ | |
| 88 | - 'comparison_button_text' => [ | |
| 89 | - 'label' => esc_html__( 'Comparison Text', 'shopbuilder' ), | |
| 90 | - 'type' => 'text', | |
| 91 | - 'condition' => [ | |
| 92 | - 'comparison_button' => 'yes', | |
| 93 | - ], | |
| 94 | - ], | |
| 95 | - ]; | |
| 96 | - $fields = Fns::insert_controls( 'comparison_button', $fields, $comparison_button, true ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - return $fields; | |
| 100 | - } | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * Widget Field | |
| 104 | - * | |
| 105 | - * @return array | |
| 106 | - */ | |
| 107 | - public static function module_button( $widget ) { | |
| 108 | - $fields = ModuleBtnControls::module_button_style( $widget ); | |
| 109 | - if ( ! empty( $fields ) ) { | |
| 110 | - $fields['module_section']['label'] = esc_html__( 'Wishlist & Compare', 'shopbuilder' ); | |
| 111 | - if ( Fns::is_module_active( 'wishlist' ) ) { | |
| 112 | - $fields['module_section']['conditions']['terms'][] = [ | |
| 113 | - 'name' => 'wishlist_button', | |
| 114 | - 'operator' => '===', | |
| 115 | - 'value' => 'yes', | |
| 116 | - ]; | |
| 117 | - } | |
| 118 | - if ( Fns::is_module_active( 'compare' ) ) { | |
| 119 | - $fields['module_section']['conditions']['terms'][] = [ | |
| 120 | - 'name' => 'comparison_button', | |
| 121 | - 'operator' => '===', | |
| 122 | - 'value' => 'yes', | |
| 123 | - ]; | |
| 124 | - } | |
| 125 | - } | |
| 126 | - | |
| 127 | - $textSetting = TextStyleSettings::widget_fields( $widget ); | |
| 128 | - | |
| 129 | - unset( $textSetting['align'] ); | |
| 130 | - $textSetting['section_style']['label'] = esc_html__( 'Text Style', 'shopbuilder' ); | |
| 131 | - $textSetting['section_style']['tab'] = 'style'; | |
| 132 | - | |
| 133 | - $text_style = [ | |
| 134 | - 'text_hover_color' => [ | |
| 135 | - 'label' => esc_html__( 'Text Hover Color', 'shopbuilder' ), | |
| 136 | - 'type' => 'color', | |
| 137 | - 'selectors' => [ | |
| 138 | - $widget->selectors['text_hover_color'] => 'color: {{VALUE}};', | |
| 139 | - ], | |
| 140 | - ], | |
| 141 | - ]; | |
| 142 | - $textSetting = Fns::insert_controls( 'text_shadow', $textSetting, $text_style ); | |
| 143 | - | |
| 144 | - $text_style = [ | |
| 145 | - 'text_margin' => [ | |
| 146 | - 'mode' => 'responsive', | |
| 147 | - 'label' => esc_html__( 'Margin', 'shopbuilder' ), | |
| 148 | - 'type' => 'dimensions', | |
| 149 | - 'size_units' => [ 'px' ], | |
| 150 | - 'selectors' => [ | |
| 151 | - $widget->selectors['text_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 152 | - ], | |
| 153 | - ], | |
| 154 | - | |
| 155 | - ]; | |
| 156 | - $textSetting = Fns::insert_controls( 'text_shadow', $textSetting, $text_style, true ); | |
| 157 | - | |
| 158 | - return $fields + $textSetting; | |
| 159 | - } | |
| 160 | - | |
| 161 | - /** | |
| 162 | - * Widget Field | |
| 163 | - * | |
| 164 | - * @return array | |
| 165 | - */ | |
| 166 | - public static function button_separator( $widget ) { | |
| 167 | - $fields = [ | |
| 168 | - 'separator_section' => [ | |
| 169 | - 'mode' => 'section_start', | |
| 170 | - 'tab' => 'style', | |
| 171 | - 'label' => esc_html__( 'Separator Style', 'shopbuilder' ), | |
| 172 | - 'condition' => [ | |
| 173 | - 'view_mode' => 'inline', | |
| 174 | - ], | |
| 175 | - ], | |
| 176 | - 'separator_typography' => [ | |
| 177 | - 'mode' => 'group', | |
| 178 | - 'type' => 'typography', | |
| 179 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 180 | - 'selector' => $widget->selectors['separator_typography'], | |
| 181 | - ], | |
| 182 | - 'separator_color_normal' => [ | |
| 183 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 184 | - 'type' => 'color', | |
| 185 | - 'selectors' => [ | |
| 186 | - $widget->selectors['separator_color_normal'] => 'color: {{VALUE}};', | |
| 187 | - ], | |
| 188 | - ], | |
| 189 | - 'separator_section_end' => [ | |
| 190 | - 'mode' => 'section_end', | |
| 191 | - ], | |
| 192 | - ]; | |
| 193 | - | |
| 194 | - return $fields; | |
| 195 | - } | |
| 196 | - | |
| 197 | - /** | |
| 198 | - * Widget Field | |
| 199 | - * | |
| 200 | - * @return array | |
| 201 | - */ | |
| 202 | - public static function module_icons() { | |
| 203 | - if ( ! Fns::is_module_active( 'wishlist' ) && ! Fns::is_module_active( 'compare' ) ) { | |
| 204 | - return []; | |
| 205 | - } | |
| 206 | - | |
| 207 | - $fields['module_icon_style_section'] = [ | |
| 208 | - 'mode' => 'section_start', | |
| 209 | - 'label' => esc_html__( 'Icons', 'shopbuilder' ), | |
| 210 | - ]; | |
| 211 | - | |
| 212 | - if ( Fns::is_module_active( 'wishlist' ) ) { | |
| 213 | - $fields['module_icon_style_section']['conditions']['terms'][] = [ | |
| 214 | - 'name' => 'wishlist_button', | |
| 215 | - 'operator' => '===', | |
| 216 | - 'value' => 'yes', | |
| 217 | - ]; | |
| 218 | - } | |
| 219 | - if ( Fns::is_module_active( 'compare' ) ) { | |
| 220 | - $fields['module_icon_style_section']['conditions']['terms'][] = [ | |
| 221 | - 'name' => 'comparison_button', | |
| 222 | - 'operator' => '===', | |
| 223 | - 'value' => 'yes', | |
| 224 | - ]; | |
| 225 | - } | |
| 226 | - | |
| 227 | - $fields = $fields + ModuleBtnControls::module_icons(); | |
| 228 | - | |
| 229 | - unset( $fields['quick_view_icon'] ); | |
| 230 | - | |
| 231 | - $fields['module_icon_style_section_end'] = [ | |
| 232 | - 'mode' => 'section_end', | |
| 233 | - ]; | |
| 234 | - | |
| 235 | - return $fields; | |
| 236 | - } | |
| 237 | - | |
| 238 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Main ProductDescription class. | |
| 4 | + * | |
| 5 | + * @package RadiusTheme\SB | |
| 6 | + */ | |
| 7 | + | |
| 8 | +namespace RadiusTheme\SB\Elementor\Widgets\Controls; | |
| 9 | + | |
| 10 | +use RadiusTheme\SB\Helpers\Fns; | |
| 11 | + | |
| 12 | +// Do not allow directly accessing this file. | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit( 'This script cannot be accessed directly.' ); | |
| 15 | +} | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * Product Description class | |
| 19 | + */ | |
| 20 | +class ActionsBtnSettings { | |
| 21 | + /** | |
| 22 | + * Widget Field | |
| 23 | + * | |
| 24 | + * @return array | |
| 25 | + */ | |
| 26 | + public static function widget_fields( $widget ) { | |
| 27 | + return self::general_section() + | |
| 28 | + self::module_icons() + | |
| 29 | + self::module_button( $widget ); | |
| 30 | + } | |
| 31 | + /** | |
| 32 | + * Widget Field | |
| 33 | + * | |
| 34 | + * @return array | |
| 35 | + */ | |
| 36 | + public static function general_section() { | |
| 37 | + $fields = [ | |
| 38 | + 'sec_general' => [ | |
| 39 | + 'mode' => 'section_start', | |
| 40 | + 'label' => esc_html__( 'General', 'shopbuilder' ), | |
| 41 | + ], | |
| 42 | + 'general_style_end' => [ | |
| 43 | + 'mode' => 'section_end', | |
| 44 | + ], | |
| 45 | + ]; | |
| 46 | + $module_switch = ModuleBtnControls::module_switch(); | |
| 47 | + unset( $module_switch['quick_view_button'] ); | |
| 48 | + $module_switch['wishlist_button']['separator'] = 'default'; | |
| 49 | + $fields = Fns::insert_controls( 'sec_general', $fields, $module_switch, true ); | |
| 50 | + return $fields; | |
| 51 | + } | |
| 52 | + /** | |
| 53 | + * Widget Field | |
| 54 | + * | |
| 55 | + * @return array | |
| 56 | + */ | |
| 57 | + public static function module_button( $widget ) { | |
| 58 | + $fields = ModuleBtnControls::module_button_style( $widget ); | |
| 59 | + if( ! empty( $fields )) { | |
| 60 | + $fields['module_section']['label'] = esc_html__('Wishlist & Compare', 'shopbuilder'); | |
| 61 | + $fields['module_section']['conditions']['terms'] = [ | |
| 62 | + [ | |
| 63 | + 'name' => 'wishlist_button', | |
| 64 | + 'operator' => '===', | |
| 65 | + 'value' => 'yes', | |
| 66 | + ], | |
| 67 | + [ | |
| 68 | + 'name' => 'comparison_button', | |
| 69 | + 'operator' => '===', | |
| 70 | + 'value' => 'yes', | |
| 71 | + ], | |
| 72 | + ]; | |
| 73 | + } | |
| 74 | + return $fields; | |
| 75 | + } | |
| 76 | + /** | |
| 77 | + * Widget Field | |
| 78 | + * | |
| 79 | + * @return array | |
| 80 | + */ | |
| 81 | + public static function module_icons() { | |
| 82 | + | |
| 83 | + $fields['module_icon_style_section'] = [ | |
| 84 | + 'mode' => 'section_start', | |
| 85 | + 'label' => esc_html__( 'Icons', 'shopbuilder' ), | |
| 86 | + 'conditions' => [ | |
| 87 | + 'terms' => [ | |
| 88 | + [ | |
| 89 | + 'name' => 'wishlist_button', | |
| 90 | + 'operator' => '===', | |
| 91 | + 'value' => 'yes', | |
| 92 | + ], | |
| 93 | + [ | |
| 94 | + 'name' => 'comparison_button', | |
| 95 | + 'operator' => '===', | |
| 96 | + 'value' => 'yes', | |
| 97 | + ], | |
| 98 | + ], | |
| 99 | + ], | |
| 100 | + ]; | |
| 101 | + | |
| 102 | + $fields = $fields + ModuleBtnControls::module_icons(); | |
| 103 | + | |
| 104 | + unset( $fields['quick_view_icon'] ); | |
| 105 | + | |
| 106 | + $fields['module_icon_style_section_end'] = [ | |
| 107 | + 'mode' => 'section_end', | |
| 108 | + ]; | |
| 109 | + | |
| 110 | + return $fields; | |
| 111 | + } | |
| 112 | + | |
| 113 | +} | |