PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Controls / StockSettings.php

StockSettings.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.6, at app/Elementor/Widgets/Controls/StockSettings.php

259 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main StockSettings class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\Controls;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
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 Stock Settings class
20 */
21 class StockSettings {
22 /**
23 * Widget Field
24 *
25 * @return array
26 */
27 public static function widget_fields( $widget ) {
28 $alignment = ControlHelper::alignment();
29 unset( $alignment['justify'] );
30 $fields = [
31 'stock_content' => [
32 'mode' => 'section_start',
33 'label' => esc_html__( 'Settings', 'shopbuilder' ),
34 'tab' => 'content',
35 ],
36 'stock_text_typography' => [
37 'mode' => 'group',
38 'type' => 'typography',
39 'label' => esc_html__( 'Typography', 'shopbuilder' ),
40 'selector' => $widget->selectors['stock_text_typography'],
41 ],
42 'in_stock_color' => [
43 'label' => esc_html__( 'In Stock Text Color', 'shopbuilder' ),
44 'type' => 'color',
45 'description' => sprintf(
46 /* translators: text*/
47 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
48 '<b>' . esc_html__( 'In stork', 'shopbuilder' ) . '</b>'
49 ),
50 'selectors' => [
51 $widget->selectors['in_stock_color'] => 'color: {{VALUE}} !important',
52 ],
53 ],
54 'outof_stock_color' => [
55 'label' => esc_html__( 'Out Of Stock Text Color', 'shopbuilder' ),
56 'type' => 'color',
57 'description' => sprintf(
58 /* translators: text*/
59 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
60 '<b>' . esc_html__( 'Out of stock', 'shopbuilder' ) . '</b>'
61 ),
62 'selectors' => [
63 $widget->selectors['outof_stock_color'] => 'color: {{VALUE}} !important',
64 ],
65 ],
66 'backorder_stock_color' => [
67 'label' => esc_html__( 'Backorder Stock Text Color', 'shopbuilder' ),
68 'type' => 'color',
69 'description' => sprintf(
70 /* translators: text*/
71 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
72 '<b>' . esc_html__( 'Backorder stock', 'shopbuilder' ) . '</b>'
73 ),
74 'selectors' => [
75 $widget->selectors['backorder_stock_color'] => 'color: {{VALUE}} !important',
76 ],
77 ],
78 'icon_size' => [
79 'label' => esc_html__( 'Icon Size (px)', 'shopbuilder' ),
80 'type' => 'slider',
81 'size_units' => [ 'px' ],
82 'range' => [
83 'px' => [
84 'min' => 0,
85 'max' => 100,
86 'step' => 1,
87 ],
88 ],
89 'default' => [
90 'size' => 16,
91 'unit' => 'px',
92 ],
93 'selectors' => [
94 $widget->selectors['icon_size']['icon'] => 'font-size: {{SIZE}}{{UNIT}}',
95 $widget->selectors['icon_size']['svg'] => 'width: {{SIZE}}{{UNIT}}',
96 ],
97 ],
98 'icon_gap' => [
99 'label' => esc_html__( 'Icon Gap (px)', 'shopbuilder' ),
100 'type' => 'slider',
101 'size_units' => [ 'px' ],
102 'range' => [
103 'px' => [
104 'min' => 0,
105 'max' => 100,
106 'step' => 1,
107 ],
108 ],
109 'default' => [
110 'size' => 5,
111 'unit' => 'px',
112 ],
113 'selectors' => [
114 $widget->selectors['icon_gap'] => 'margin-right: {{SIZE}}{{UNIT}}',
115 ],
116 ],
117 'stock_alignment' => [
118 'mode' => 'responsive',
119 'type' => 'choose',
120 'label' => esc_html__( 'Alignment', 'shopbuilder' ),
121 'options' => [
122 'left' => [
123 'title' => esc_html__( 'Left', 'shopbuilder' ),
124 'icon' => 'eicon-text-align-left',
125 ],
126 'center' => [
127 'title' => esc_html__( 'Center', 'shopbuilder' ),
128 'icon' => 'eicon-text-align-center',
129 ],
130 'right' => [
131 'title' => esc_html__( 'Right', 'shopbuilder' ),
132 'icon' => 'eicon-text-align-right',
133 ],
134 ],
135 'selectors' => [
136 $widget->selectors['stock_alignment'] => 'text-align: {{VALUE}};',
137 ],
138 ],
139 'stock_padding' => [
140 'mode' => 'responsive',
141 'type' => 'dimensions',
142 'label' => esc_html__( 'Padding', 'shopbuilder' ),
143 'size_units' => [ 'px', '%', 'em' ],
144 'selectors' => [
145 $widget->selectors['stock_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
146 ],
147 ],
148 'stock_margin' => [
149 'mode' => 'responsive',
150 'type' => 'dimensions',
151 'label' => esc_html__( 'Margin', 'shopbuilder' ),
152 'size_units' => [ 'px', '%', 'em' ],
153 'selectors' => [
154 $widget->selectors['stock_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
155 ],
156 ],
157 'meta_content_end' => [
158 'mode' => 'section_end',
159 ],
160 'in_stock_icon_section' => [
161 'mode' => 'section_start',
162 'label' => esc_html__( 'In Stock Icon', 'shopbuilder' ),
163 'tab' => 'content',
164 ],
165 'in_stock_icon' => [
166 'label' => esc_html__( 'Icon', 'shopbuilder' ),
167 'type' => 'icons',
168 'description' => sprintf(
169 /* translators: text*/
170 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
171 '<b>' . esc_html__( 'In stork', 'shopbuilder' ) . '</b>'
172 ),
173 'default' => [
174 'value' => 'rtsb-icon rtsb-icon-check-alt',
175 'library' => 'rtsb-fonts',
176 ],
177 'separator' => 'default',
178 ],
179 'in_stock_icon_end' => [
180 'mode' => 'section_end',
181 ],
182 'out_of_stock_icon_section' => [
183 'mode' => 'section_start',
184 'label' => esc_html__( 'Out Of Stock Icon', 'shopbuilder' ),
185 'tab' => 'content',
186 ],
187 'out_of_stock_icon' => [
188 'label' => esc_html__( 'Icon', 'shopbuilder' ),
189 'type' => 'icons',
190 'description' => sprintf(
191 /* translators: text*/
192 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
193 '<b>' . esc_html__( 'Out of stork', 'shopbuilder' ) . '</b>'
194 ),
195 'default' => [
196 'value' => 'fas fa-times-circle',
197 'library' => 'fa-solid',
198 ],
199 'separator' => 'default',
200 ],
201 'out_of_stock_icon_end' => [
202 'mode' => 'section_end',
203 ],
204 'backorder_icon_section' => [
205 'mode' => 'section_start',
206 'label' => esc_html__( 'Backorder Stock Icon', 'shopbuilder' ),
207 'tab' => 'content',
208 ],
209 'stock_backorder_icon' => [
210 'label' => esc_html__( 'Icon', 'shopbuilder' ),
211 'type' => 'icons',
212 'description' => sprintf(
213 /* translators: text*/
214 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
215 '<b>' . esc_html__( 'Backorder stock', 'shopbuilder' ) . '</b>'
216 ),
217 'default' => [
218 'value' => 'rtsb-icon rtsb-icon-cart',
219 'library' => 'rtsb-fonts',
220 ],
221 'separator' => 'default',
222 ],
223 ];
224
225 $fields['backorder_icon_end'] = [
226 'mode' => 'section_end',
227 ];
228
229 if ( Fns::is_module_active( 'pre_order' ) ) {
230 $fields['pre_order_icon_section'] = [
231 'mode' => 'section_start',
232 'label' => esc_html__( 'Pre-Order Stock Icon', 'shopbuilder' ),
233 'tab' => 'content',
234 ];
235
236 $fields['stock_pre_order_icon'] = [
237 'label' => esc_html__( 'Icon', 'shopbuilder' ),
238 'type' => 'icons',
239 'description' => sprintf(
240 /* translators: text*/
241 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
242 '<b>' . esc_html__( 'Pre-Order stock', 'shopbuilder' ) . '</b>'
243 ),
244 'default' => [
245 'value' => 'rtsb-icon rtsb-icon-cart',
246 'library' => 'rtsb-fonts',
247 ],
248 'separator' => 'default',
249 ];
250
251 $fields['pre_order_icon_end'] = [
252 'mode' => 'section_end',
253 ];
254 }
255
256 return $fields;
257 }
258 }
259