PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.15
ShopBuilder – WooCommerce Builder For Elementor v2.1.15
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 2.1.15, at app/Elementor/Widgets/Controls/StockSettings.php

258 lines 7.5 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'] => 'font-size: {{SIZE}}{{UNIT}}',
95 ],
96 ],
97 'icon_gap' => [
98 'label' => esc_html__( 'Icon Gap (px)', 'shopbuilder' ),
99 'type' => 'slider',
100 'size_units' => [ 'px' ],
101 'range' => [
102 'px' => [
103 'min' => 0,
104 'max' => 100,
105 'step' => 1,
106 ],
107 ],
108 'default' => [
109 'size' => 5,
110 'unit' => 'px',
111 ],
112 'selectors' => [
113 $widget->selectors['icon_gap'] => 'margin-right: {{SIZE}}{{UNIT}}',
114 ],
115 ],
116 'stock_alignment' => [
117 'mode' => 'responsive',
118 'type' => 'choose',
119 'label' => esc_html__( 'Alignment', 'shopbuilder' ),
120 'options' => [
121 'left' => [
122 'title' => esc_html__( 'Left', 'shopbuilder' ),
123 'icon' => 'eicon-text-align-left',
124 ],
125 'center' => [
126 'title' => esc_html__( 'Center', 'shopbuilder' ),
127 'icon' => 'eicon-text-align-center',
128 ],
129 'right' => [
130 'title' => esc_html__( 'Right', 'shopbuilder' ),
131 'icon' => 'eicon-text-align-right',
132 ],
133 ],
134 'selectors' => [
135 $widget->selectors['stock_alignment'] => 'text-align: {{VALUE}};',
136 ],
137 ],
138 'stock_padding' => [
139 'mode' => 'responsive',
140 'type' => 'dimensions',
141 'label' => esc_html__( 'Padding', 'shopbuilder' ),
142 'size_units' => [ 'px', '%', 'em' ],
143 'selectors' => [
144 $widget->selectors['stock_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
145 ],
146 ],
147 'stock_margin' => [
148 'mode' => 'responsive',
149 'type' => 'dimensions',
150 'label' => esc_html__( 'Margin', 'shopbuilder' ),
151 'size_units' => [ 'px', '%', 'em' ],
152 'selectors' => [
153 $widget->selectors['stock_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
154 ],
155 ],
156 'meta_content_end' => [
157 'mode' => 'section_end',
158 ],
159 'in_stock_icon_section' => [
160 'mode' => 'section_start',
161 'label' => esc_html__( 'In Stock Icon', 'shopbuilder' ),
162 'tab' => 'content',
163 ],
164 'in_stock_icon' => [
165 'label' => esc_html__( 'Icon', 'shopbuilder' ),
166 'type' => 'icons',
167 'description' => sprintf(
168 /* translators: text*/
169 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
170 '<b>' . esc_html__( 'In stork', 'shopbuilder' ) . '</b>'
171 ),
172 'default' => [
173 'value' => 'rtsb-icon rtsb-icon-check-alt',
174 'library' => 'rtsb-fonts',
175 ],
176 'separator' => 'default',
177 ],
178 'in_stock_icon_end' => [
179 'mode' => 'section_end',
180 ],
181 'out_of_stock_icon_section' => [
182 'mode' => 'section_start',
183 'label' => esc_html__( 'Out Of Stock Icon', 'shopbuilder' ),
184 'tab' => 'content',
185 ],
186 'out_of_stock_icon' => [
187 'label' => esc_html__( 'Icon', 'shopbuilder' ),
188 'type' => 'icons',
189 'description' => sprintf(
190 /* translators: text*/
191 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
192 '<b>' . esc_html__( 'Out of stork', 'shopbuilder' ) . '</b>'
193 ),
194 'default' => [
195 'value' => 'fas fa-times-circle',
196 'library' => 'fa-solid',
197 ],
198 'separator' => 'default',
199 ],
200 'out_of_stock_icon_end' => [
201 'mode' => 'section_end',
202 ],
203 'backorder_icon_section' => [
204 'mode' => 'section_start',
205 'label' => esc_html__( 'Backorder Stock Icon', 'shopbuilder' ),
206 'tab' => 'content',
207 ],
208 'stock_backorder_icon' => [
209 'label' => esc_html__( 'Icon', 'shopbuilder' ),
210 'type' => 'icons',
211 'description' => sprintf(
212 /* translators: text*/
213 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
214 '<b>' . esc_html__( 'Backorder stock', 'shopbuilder' ) . '</b>'
215 ),
216 'default' => [
217 'value' => 'rtsb-icon rtsb-icon-cart',
218 'library' => 'rtsb-fonts',
219 ],
220 'separator' => 'default',
221 ],
222 ];
223
224 $fields['backorder_icon_end'] = [
225 'mode' => 'section_end',
226 ];
227
228 if ( Fns::is_module_active( 'pre_order' ) ) {
229 $fields['pre_order_icon_section'] = [
230 'mode' => 'section_start',
231 'label' => esc_html__( 'Pre-Order Stock Icon', 'shopbuilder' ),
232 'tab' => 'content',
233 ];
234
235 $fields['stock_pre_order_icon'] = [
236 'label' => esc_html__( 'Icon', 'shopbuilder' ),
237 'type' => 'icons',
238 'description' => sprintf(
239 /* translators: text*/
240 esc_html__( 'Settings will work for %s product', 'shopbuilder' ),
241 '<b>' . esc_html__( 'Pre-Order stock', 'shopbuilder' ) . '</b>'
242 ),
243 'default' => [
244 'value' => 'rtsb-icon rtsb-icon-cart',
245 'library' => 'rtsb-fonts',
246 ],
247 'separator' => 'default',
248 ];
249
250 $fields['pre_order_icon_end'] = [
251 'mode' => 'section_end',
252 ];
253 }
254
255 return $fields;
256 }
257 }
258