← All changes
|
app/Elementor/Widgets/Controls/ButtonSettings.php
+162
-185
2.1.11
→
1.1.4
View file →
| @@ -1,185 +1,162 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Main ProductDescription class. | |
| 4 | - * | |
| 5 | - * @package RadiusTheme\SB | |
| 6 | - */ | |
| 7 | - | |
| 8 | -namespace RadiusTheme\SB\Elementor\Widgets\Controls; | |
| 9 | - | |
| 10 | -// Do not allow directly accessing this file. | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | - exit( 'This script cannot be accessed directly.' ); | |
| 13 | -} | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * Product Description class | |
| 17 | - */ | |
| 18 | -class ButtonSettings { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * Widget Field | |
| 22 | - * | |
| 23 | - * @return array | |
| 24 | - */ | |
| 25 | - public static function style_settings( $widget ) { | |
| 26 | - | |
| 27 | - $fields = [ | |
| 28 | - 'button_section_start' => [ | |
| 29 | - 'mode' => 'section_start', | |
| 30 | - 'label' => esc_html__( 'Button', 'shopbuilder' ), | |
| 31 | - 'tab' => 'style', | |
| 32 | - ], | |
| 33 | - 'button_typography' => [ | |
| 34 | - 'mode' => 'group', | |
| 35 | - 'type' => 'typography', | |
| 36 | - 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 37 | - 'selector' => $widget->selectors['button_typography'], | |
| 38 | - ], | |
| 39 | - 'button_height' => [ | |
| 40 | - 'label' => esc_html__( 'Height', 'shopbuilder' ), | |
| 41 | - 'type' => 'slider', | |
| 42 | - 'range' => [ | |
| 43 | - 'px' => [ | |
| 44 | - 'min' => 10, | |
| 45 | - 'max' => 200, | |
| 46 | - ], | |
| 47 | - ], | |
| 48 | - 'selectors' => [ | |
| 49 | - $widget->selectors['button_height'] => 'height: {{SIZE}}{{UNIT}};', | |
| 50 | - ], | |
| 51 | - ], | |
| 52 | - | |
| 53 | - 'button_width' => [ | |
| 54 | - 'label' => esc_html__( 'Width', 'shopbuilder' ), | |
| 55 | - 'size_units' => [ 'px', '%' ], | |
| 56 | - 'mode' => 'responsive', | |
| 57 | - 'type' => 'slider', | |
| 58 | - 'range' => [ | |
| 59 | - 'px' => [ | |
| 60 | - 'min' => 10, | |
| 61 | - 'max' => 900, | |
| 62 | - ], | |
| 63 | - '%' => [ | |
| 64 | - 'min' => 0, | |
| 65 | - 'max' => 100, | |
| 66 | - ], | |
| 67 | - ], | |
| 68 | - 'selectors' => [ | |
| 69 | - $widget->selectors['button_width'] => 'width: {{SIZE}}{{UNIT}};', | |
| 70 | - ], | |
| 71 | - ], | |
| 72 | - | |
| 73 | - 'button_tabs_start' => [ | |
| 74 | - 'mode' => 'tabs_start', | |
| 75 | - ], | |
| 76 | - 'button_normal' => [ | |
| 77 | - 'mode' => 'tab_start', | |
| 78 | - 'label' => esc_html__( 'Normal', 'shopbuilder' ), | |
| 79 | - ], | |
| 80 | - 'button_text_color_normal' => [ | |
| 81 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 82 | - 'type' => 'color', | |
| 83 | - | |
| 84 | - 'separator' => 'default', | |
| 85 | - 'selectors' => [ | |
| 86 | - $widget->selectors['button_text_color_normal'] => 'color: {{VALUE}}!important;', | |
| 87 | - ], | |
| 88 | - ], | |
| 89 | - 'button_bg_color_normal' => [ | |
| 90 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 91 | - 'type' => 'color', | |
| 92 | - | |
| 93 | - 'selectors' => [ | |
| 94 | - $widget->selectors['button_bg_color_normal'] => 'background-color: {{VALUE}} !important;', | |
| 95 | - ], | |
| 96 | - ], | |
| 97 | - | |
| 98 | - 'button_border' => [ | |
| 99 | - 'mode' => 'group', | |
| 100 | - 'type' => 'border', | |
| 101 | - 'selector' => $widget->selectors['button_border'], | |
| 102 | - 'size_units' => [ 'px' ], | |
| 103 | - ], | |
| 104 | - 'button_normal_end' => [ | |
| 105 | - 'mode' => 'tab_end', | |
| 106 | - ], | |
| 107 | - 'button_hover' => [ | |
| 108 | - 'mode' => 'tab_start', | |
| 109 | - 'label' => esc_html__( 'Hover', 'shopbuilder' ), | |
| 110 | - ], | |
| 111 | - 'button_text_color_hover' => [ | |
| 112 | - 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 113 | - 'type' => 'color', | |
| 114 | - | |
| 115 | - 'separator' => 'default', | |
| 116 | - 'selectors' => [ | |
| 117 | - $widget->selectors['button_text_color_hover'] => 'color: {{VALUE}}!important;', | |
| 118 | - ], | |
| 119 | - ], | |
| 120 | - 'button_bg_color_hover' => [ | |
| 121 | - 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 122 | - 'type' => 'color', | |
| 123 | - | |
| 124 | - 'selectors' => [ | |
| 125 | - $widget->selectors['button_bg_color_hover'] => 'background-color: {{VALUE}} !important;', | |
| 126 | - ], | |
| 127 | - ], | |
| 128 | - 'button_border_hover_color' => [ | |
| 129 | - 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 130 | - 'type' => 'color', | |
| 131 | - | |
| 132 | - 'selectors' => [ | |
| 133 | - $widget->selectors['button_border_hover_color'] => 'border-color: {{VALUE}};', | |
| 134 | - ], | |
| 135 | - ], | |
| 136 | - 'button_hover_end' => [ | |
| 137 | - 'mode' => 'tab_end', | |
| 138 | - ], | |
| 139 | - 'button_tabs_end' => [ | |
| 140 | - 'mode' => 'tabs_end', | |
| 141 | - ], | |
| 142 | - 'button_border_radius' => [ | |
| 143 | - 'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), | |
| 144 | - 'type' => 'dimensions', | |
| 145 | - 'default' => [ | |
| 146 | - 'top' => '5', | |
| 147 | - 'right' => '5', | |
| 148 | - 'bottom' => '5', | |
| 149 | - 'left' => '5', | |
| 150 | - 'unit' => 'px', | |
| 151 | - 'isLinked' => true, | |
| 152 | - ], | |
| 153 | - 'size_units' => [ 'px' ], | |
| 154 | - 'separator' => 'before', | |
| 155 | - 'selectors' => [ | |
| 156 | - $widget->selectors['button_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 157 | - ], | |
| 158 | - ], | |
| 159 | - 'button_padding' => [ | |
| 160 | - 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), | |
| 161 | - 'type' => 'dimensions', | |
| 162 | - 'mode' => 'responsive', | |
| 163 | - 'size_units' => [ 'px' ], | |
| 164 | - 'selectors' => [ | |
| 165 | - $widget->selectors['button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 166 | - ], | |
| 167 | - 'separator' => 'before', | |
| 168 | - ], | |
| 169 | - | |
| 170 | - 'button_margin' => [ | |
| 171 | - 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 172 | - 'type' => 'dimensions', | |
| 173 | - 'mode' => 'responsive', | |
| 174 | - 'size_units' => [ 'px' ], | |
| 175 | - 'selectors' => [ | |
| 176 | - $widget->selectors['button_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 177 | - ], | |
| 178 | - ], | |
| 179 | - 'button_section_end' => [ | |
| 180 | - 'mode' => 'section_end', | |
| 181 | - ], | |
| 182 | - ]; | |
| 183 | - return $fields; | |
| 184 | - } | |
| 185 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Main ProductDescription class. | |
| 4 | + * | |
| 5 | + * @package RadiusTheme\SB | |
| 6 | + */ | |
| 7 | + | |
| 8 | +namespace RadiusTheme\SB\Elementor\Widgets\Controls; | |
| 9 | + | |
| 10 | +// Do not allow directly accessing this file. | |
| 11 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | + exit( 'This script cannot be accessed directly.' ); | |
| 13 | +} | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Product Description class | |
| 17 | + */ | |
| 18 | +class ButtonSettings { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * Widget Field | |
| 22 | + * | |
| 23 | + * @return array | |
| 24 | + */ | |
| 25 | + public static function style_settings( $widget ) { | |
| 26 | + $fields = [ | |
| 27 | + 'button_section_start' => [ | |
| 28 | + 'mode' => 'section_start', | |
| 29 | + 'label' => esc_html__( 'Button', 'shopbuilder' ), | |
| 30 | + 'tab' => 'style', | |
| 31 | + ], | |
| 32 | + 'button_typography' => [ | |
| 33 | + 'mode' => 'group', | |
| 34 | + 'type' => 'typography', | |
| 35 | + 'label' => esc_html__( 'Typography', 'shopbuilder' ), | |
| 36 | + 'selector' => $widget->selectors['button_typography'], | |
| 37 | + ], | |
| 38 | + 'button_height' => [ | |
| 39 | + 'label' => esc_html__( 'Height', 'shopbuilder' ), | |
| 40 | + 'type' => 'slider', | |
| 41 | + 'range' => [ | |
| 42 | + 'px' => [ | |
| 43 | + 'min' => 10, | |
| 44 | + 'max' => 200, | |
| 45 | + ], | |
| 46 | + ], | |
| 47 | + 'selectors' => [ | |
| 48 | + $widget->selectors['button_height'] => 'height: {{SIZE}}{{UNIT}};', | |
| 49 | + ], | |
| 50 | + ], | |
| 51 | + 'button_tabs_start' => [ | |
| 52 | + 'mode' => 'tabs_start', | |
| 53 | + ], | |
| 54 | + 'button_normal' => [ | |
| 55 | + 'mode' => 'tab_start', | |
| 56 | + 'label' => esc_html__( 'Normal', 'shopbuilder' ), | |
| 57 | + ], | |
| 58 | + 'button_text_color_normal' => [ | |
| 59 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 60 | + 'type' => 'color', | |
| 61 | + | |
| 62 | + 'separator' => 'default', | |
| 63 | + 'selectors' => [ | |
| 64 | + $widget->selectors['button_text_color_normal'] => 'color: {{VALUE}};', | |
| 65 | + ], | |
| 66 | + ], | |
| 67 | + 'button_bg_color_normal' => [ | |
| 68 | + 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 69 | + 'type' => 'color', | |
| 70 | + | |
| 71 | + 'selectors' => [ | |
| 72 | + $widget->selectors['button_bg_color_normal'] => 'background-color: {{VALUE}};', | |
| 73 | + ], | |
| 74 | + ], | |
| 75 | + | |
| 76 | + 'button_border' => [ | |
| 77 | + 'mode' => 'group', | |
| 78 | + 'type' => 'border', | |
| 79 | + 'selector' => $widget->selectors['button_border'], | |
| 80 | + 'size_units' => [ 'px' ], | |
| 81 | + ], | |
| 82 | + 'button_normal_end' => [ | |
| 83 | + 'mode' => 'tab_end', | |
| 84 | + ], | |
| 85 | + 'button_hover' => [ | |
| 86 | + 'mode' => 'tab_start', | |
| 87 | + 'label' => esc_html__( 'Hover', 'shopbuilder' ), | |
| 88 | + ], | |
| 89 | + 'button_text_color_hover' => [ | |
| 90 | + 'label' => esc_html__( 'Color', 'shopbuilder' ), | |
| 91 | + 'type' => 'color', | |
| 92 | + | |
| 93 | + 'separator' => 'default', | |
| 94 | + 'selectors' => [ | |
| 95 | + $widget->selectors['button_text_color_hover'] => 'color: {{VALUE}};', | |
| 96 | + ], | |
| 97 | + ], | |
| 98 | + 'button_bg_color_hover' => [ | |
| 99 | + 'label' => esc_html__( 'Background Color', 'shopbuilder' ), | |
| 100 | + 'type' => 'color', | |
| 101 | + | |
| 102 | + 'selectors' => [ | |
| 103 | + $widget->selectors['button_bg_color_hover'] => 'background-color: {{VALUE}};', | |
| 104 | + ], | |
| 105 | + ], | |
| 106 | + 'button_border_hover_color' => [ | |
| 107 | + 'label' => esc_html__( 'Border Color', 'shopbuilder' ), | |
| 108 | + 'type' => 'color', | |
| 109 | + | |
| 110 | + 'selectors' => [ | |
| 111 | + $widget->selectors['button_border_hover_color'] => 'border-color: {{VALUE}};', | |
| 112 | + ], | |
| 113 | + ], | |
| 114 | + 'button_hover_end' => [ | |
| 115 | + 'mode' => 'tab_end', | |
| 116 | + ], | |
| 117 | + 'button_tabs_end' => [ | |
| 118 | + 'mode' => 'tabs_end', | |
| 119 | + ], | |
| 120 | + 'button_border_radius' => [ | |
| 121 | + 'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ), | |
| 122 | + 'type' => 'dimensions', | |
| 123 | + 'default' => [ | |
| 124 | + 'top' => '5', | |
| 125 | + 'right' => '5', | |
| 126 | + 'bottom' => '5', | |
| 127 | + 'left' => '5', | |
| 128 | + 'unit' => 'px', | |
| 129 | + 'isLinked' => true, | |
| 130 | + ], | |
| 131 | + 'size_units' => [ 'px' ], | |
| 132 | + 'separator' => 'before', | |
| 133 | + 'selectors' => [ | |
| 134 | + $widget->selectors['button_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 135 | + ], | |
| 136 | + ], | |
| 137 | + 'button_padding' => [ | |
| 138 | + 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ), | |
| 139 | + 'type' => 'dimensions', | |
| 140 | + 'size_units' => [ 'px' ], | |
| 141 | + 'selectors' => [ | |
| 142 | + $widget->selectors['button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 143 | + ], | |
| 144 | + 'separator' => 'before', | |
| 145 | + ], | |
| 146 | + | |
| 147 | + 'button_margin' => [ | |
| 148 | + 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ), | |
| 149 | + 'type' => 'dimensions', | |
| 150 | + 'size_units' => [ 'px' ], | |
| 151 | + 'selectors' => [ | |
| 152 | + $widget->selectors['button_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', | |
| 153 | + ], | |
| 154 | + ], | |
| 155 | + 'button_section_end' => [ | |
| 156 | + 'mode' => 'section_end', | |
| 157 | + ], | |
| 158 | + ]; | |
| 159 | + return $fields; | |
| 160 | + } | |
| 161 | + | |
| 162 | +} | |