PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.4
Shortcodes and extra features for Phlox theme v2.17.4
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / widgets / theme-elements / search.php
auxin-elements / includes / elementor / widgets / theme-elements Last commit date
breadcrumbs.php 1 year ago copyright.php 1 year ago current-time.php 1 year ago logo.php 1 year ago menu.php 1 year ago modern-search.php 1 year ago search.php 1 year ago select.php 1 year ago shopping-cart.php 1 year ago site-title.php 1 year ago
search.php
509 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements\Theme_Elements;
3
4 use Elementor\Plugin;
5 use Elementor\Widget_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
9 use Elementor\Group_Control_Border;
10
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 /**
17 * Elementor 'SearchBox' widget.
18 *
19 * Elementor widget that displays an 'SearchBox'.
20 *
21 * @since 1.0.0
22 */
23 class SearchBox extends Widget_Base {
24
25 /**
26 * Get widget name.
27 *
28 * Retrieve 'SearchBox' widget name.
29 *
30 * @since 1.0.0
31 * @access public
32 *
33 * @return string Widget name.
34 */
35 public function get_name() {
36 return 'aux_search_box';
37 }
38
39 /**
40 * Get widget title.
41 *
42 * Retrieve 'SearchBox' widget title.
43 *
44 * @since 1.0.0
45 * @access public
46 *
47 * @return string Widget title.
48 */
49 public function get_title() {
50 return __('Search Form', 'auxin-elements' );
51 }
52
53 /**
54 * Get widget icon.
55 *
56 * Retrieve 'SearchBox' widget icon.
57 *
58 * @since 1.0.0
59 * @access public
60 *
61 * @return string Widget icon.
62 */
63 public function get_icon() {
64 return 'eicon-search auxin-badge';
65 }
66
67 /**
68 * Get widget categories.
69 *
70 * Retrieve 'SearchBox' widget icon.
71 *
72 * @since 1.0.0
73 * @access public
74 *
75 * @return string Widget icon.
76 */
77 public function get_categories() {
78 return array( 'auxin-core', 'auxin-theme-elements' );
79 }
80
81 /**
82 * Register 'SearchBox' widget controls.
83 *
84 * Adds different input fields to allow the user to change and customize the widget settings.
85 *
86 * @since 1.0.0
87 * @access protected
88 */
89 protected function register_controls() {
90
91 $this->start_controls_section(
92 'general',
93 array(
94 'label' => __('General', 'auxin-elements' ),
95 )
96 );
97
98 $this->add_control(
99 'type',
100 array(
101 'label' => __('Type', 'auxin-elements'),
102 'type' => Controls_Manager::SELECT,
103 'default' => 'icon',
104 'options' => array(
105 'form' => __('Form' , 'auxin-elements' ),
106 'icon' => __('Icon' , 'auxin-elements' )
107 )
108 )
109 );
110
111 $this->add_control(
112 'submit_type',
113 array(
114 'label' => __('Submit Button Type', 'auxin-elements'),
115 'type' => Controls_Manager::SELECT,
116 'default' => 'none',
117 'options' => array(
118 'none' => __('None' , 'auxin-elements' ),
119 'icon' => __('Icon' , 'auxin-elements' ),
120 'button' => __('Button' , 'auxin-elements' ),
121 ),
122 'condition' => array(
123 'type' => 'form'
124 )
125 )
126 );
127
128 $this->add_control(
129 'aux_search_icon',
130 array(
131 'label' => __('Icon','auxin-elements' ),
132 'description' => __('Please choose an icon from the list.', 'auxin-elements'),
133 'type' => Controls_Manager::ICONS,
134 'conditions' => array(
135 'relation' => 'or',
136 'terms' => array(
137 array(
138 'name' => 'type',
139 'operator' => '===',
140 'value' => 'icon'
141 ),
142 array(
143 'name' => 'submit_type',
144 'operator' => '===',
145 'value' => 'icon'
146 )
147 )
148 )
149 )
150 );
151
152 $this->add_control(
153 'has_category',
154 array(
155 'label' => __('Search by Category', 'auxin-elements'),
156 'type' => Controls_Manager::SWITCHER,
157 'label_on' => __( 'On', 'auxin-elements' ),
158 'label_off' => __( 'Off', 'auxin-elements' ),
159 'return_value' => true,
160 'default' => false,
161 'condition' => array(
162 'type' => 'form'
163 )
164 )
165 );
166
167 $this->end_controls_section();
168
169 /*-----------------------------------------------------------------------------------*/
170 /* Style TAB
171 /*-----------------------------------------------------------------------------------*/
172
173 /* Icon Section
174 /*-------------------------------------*/
175 $this->start_controls_section(
176 'icon_section',
177 array(
178 'label' => __( 'Icon', 'auxin-elements' ),
179 'tab' => Controls_Manager::TAB_STYLE,
180 'conditions' => array(
181 'relation' => 'or',
182 'terms' => array(
183 array(
184 'name' => 'type',
185 'operator' => '===',
186 'value' => 'icon'
187 ),
188 array(
189 'name' => 'submit_type',
190 'operator' => '===',
191 'value' => 'icon'
192 )
193 )
194 )
195 )
196 );
197
198 $this->add_control(
199 'icon_background_color',
200 array(
201 'label' => __('Background Color', 'auxin-elements'),
202 'type' => Controls_Manager::COLOR,
203 'default' => 'transparent',
204 'selectors' => array(
205 '{{WRAPPER}} .aux-search-form .aux-submit-icon-container,{{WRAPPER}} .aux-search-section button.aux-search-icon, {{WRAPPER}} .aux-search-section svg.aux-search-icon' => 'background-color: {{VALUE}}',
206 )
207 )
208 );
209
210 $this->add_responsive_control(
211 'icon_size',
212 array(
213 'label' => __( 'Size', 'auxin-elements' ),
214 'type' => Controls_Manager::SLIDER,
215 'size_units' => array( 'px', 'em' ),
216 'range' => array(
217 'px' => array(
218 'max' => 100
219 ),
220 'em' => array(
221 'max' => 10
222 )
223 ),
224 'selectors' => array(
225 '{{WRAPPER}} .aux-search-icon:before, {{WRAPPER}} .aux-submit-icon-container:before' => 'font-size: {{SIZE}}{{UNIT}};',
226 '{{WRAPPER}} svg' => 'font-size: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};width: auto;',
227 )
228 )
229 );
230
231 $this->add_control(
232 'icon_color',
233 array(
234 'label' => __('Icon color', 'auxin-elements'),
235 'type' => Controls_Manager::COLOR,
236 'default' => '#303030',
237 'selectors' => array(
238 '{{WRAPPER}} .aux-search-icon:before, {{WRAPPER}} .aux-submit-icon-container:before' => 'color: {{VALUE}}',
239 '{{WRAPPER}} svg' => 'fill: {{VALUE}};',
240 )
241 )
242 );
243
244 $this->add_responsive_control(
245 'icon_margin',
246 array(
247 'label' => __( 'Icon Margin', 'auxin-elements' ),
248 'type' => Controls_Manager::DIMENSIONS,
249 'size_units' => array( 'px', '%' ),
250 'selectors' => array(
251 '{{WRAPPER}} .aux-search-icon, {{WRAPPER}} .aux-submit-icon-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
252 )
253 )
254 );
255
256 $this->end_controls_section();
257
258 /* Icon Section
259 /*-------------------------------------*/
260 $this->start_controls_section(
261 'form_section',
262 array(
263 'label' => __( 'Form', 'auxin-elements' ),
264 'tab' => Controls_Manager::TAB_STYLE,
265 'conditions' => array(
266 'relation' => 'or',
267 'terms' => array(
268 array(
269 'name' => 'type',
270 'operator' => '===',
271 'value' => 'form'
272 )
273 )
274 )
275 )
276 );
277
278 $this->add_group_control(
279 Group_Control_Typography::get_type(),
280 array(
281 'name' => 'form_typgraphy',
282 'global' => [
283 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
284 ],
285 'selector' => '{{WRAPPER}} .aux-search-form .aux-search-field'
286 )
287 );
288
289
290 $this->add_responsive_control(
291 'form_width',
292 array(
293 'label' => __('Width','auxin-elements' ),
294 'type' => Controls_Manager::SLIDER,
295 'size_units' => array('px', 'em','%'),
296 'range' => array(
297 '%' => array(
298 'min' => 1,
299 'max' => 120,
300 'step' => 1
301 ),
302 'em' => array(
303 'min' => 1,
304 'max' => 120,
305 'step' => 1
306 ),
307 'px' => array(
308 'min' => 1,
309 'max' => 1900,
310 'step' => 1
311 )
312 ),
313 'selectors' => array(
314 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'max-width:{{SIZE}}{{UNIT}};'
315 ),
316 )
317 );
318
319 $this->add_responsive_control(
320 'form_margin',
321 array(
322 'label' => __( 'Margin', 'auxin-elements' ),
323 'type' => Controls_Manager::DIMENSIONS,
324 'size_units' => array( 'px', '%' ),
325 'selectors' => array(
326 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
327 )
328 )
329 );
330
331 $this->add_responsive_control(
332 'form_padding',
333 array(
334 'label' => __( 'Padding', 'auxin-elements' ),
335 'type' => Controls_Manager::DIMENSIONS,
336 'size_units' => array( 'px', '%' ),
337 'selectors' => array(
338 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
339 )
340 )
341 );
342
343 $this->add_control(
344 'form_color',
345 array(
346 'label' => __('Form Background Color', 'auxin-elements'),
347 'type' => Controls_Manager::COLOR,
348 'default' => '#FFF',
349 'selectors' => array(
350 '{{WRAPPER}} .aux-search-form .aux-search-field, {{WRAPPER}} .aux-search-form select' => 'background-color: {{VALUE}}',
351 )
352 )
353 );
354
355 $this->add_group_control(
356 Group_Control_Border::get_type(),
357 array(
358 'name' => 'form_border',
359 'selector' => '{{WRAPPER}} .aux-search-form .aux-search-field',
360 'separator' => 'none'
361 )
362 );
363
364 $this->add_control(
365 'form_border_radius',
366 array(
367 'label' => __( 'Border Radius', 'auxin-elements' ),
368 'type' => Controls_Manager::DIMENSIONS,
369 'size_units' => array( 'px', 'em', '%' ),
370 'selectors' => array(
371 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow:hidden;'
372 ),
373 'allowed_dimensions' => 'all',
374 'separator' => 'after'
375 )
376 );
377
378 $this->end_controls_section();
379
380 /* Icon Section
381 /*-------------------------------------*/
382 $this->start_controls_section(
383 'button_section',
384 array(
385 'label' => __( 'Button', 'auxin-elements' ),
386 'tab' => Controls_Manager::TAB_STYLE,
387 'conditions' => array(
388 'relation' => 'and',
389 'terms' => array(
390 array(
391 'name' => 'type',
392 'operator' => '===',
393 'value' => 'form'
394 ),
395 array(
396 'name' => 'submit_type',
397 'operator' => '===',
398 'value' => 'button'
399 )
400 )
401 )
402 )
403 );
404
405 $this->add_control(
406 'button_color',
407 array(
408 'label' => __('Background Color', 'auxin-elements'),
409 'type' => Controls_Manager::COLOR,
410 'default' => '#303030',
411 'selectors' => array(
412 '{{WRAPPER}} .aux-search-form .aux-search-submit' => 'background-color: {{VALUE}}',
413 )
414 )
415 );
416
417 $this->add_responsive_control(
418 'button_padding',
419 array(
420 'label' => __( 'Padding', 'auxin-elements' ),
421 'type' => Controls_Manager::DIMENSIONS,
422 'size_units' => array( 'px', '%' ),
423 'selectors' => array(
424 '{{WRAPPER}} .aux-search-form .aux-search-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
425 )
426 )
427 );
428
429 $this->add_responsive_control(
430 'button_margin',
431 array(
432 'label' => __( 'Margin', 'auxin-elements' ),
433 'type' => Controls_Manager::DIMENSIONS,
434 'size_units' => array( 'px', '%' ),
435 'selectors' => array(
436 '{{WRAPPER}} .aux-search-form .aux-search-submit' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
437 )
438 )
439 );
440
441 $this->add_group_control(
442 Group_Control_Typography::get_type(),
443 array(
444 'name' => 'button_typgraphy',
445 'global' => [
446 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
447 ],
448 'selector' => '{{WRAPPER}} .aux-search-form .aux-search-submit'
449 )
450 );
451
452 $this->end_controls_section();
453 }
454
455 /**
456 * Render image box widget output on the frontend.
457 *
458 * Written in PHP and used to generate the final HTML.
459 *
460 * @since 1.0.0
461 * @access protected
462 */
463 protected function render() {
464 $settings = $this->get_settings_for_display();
465
466 $args = [];
467
468 $is_edit = \Elementor\Plugin::instance()->editor->is_edit_mode();
469 $is_preview = isset( $_GET['preview'] ) && $_GET['preview'] ? true : false;
470
471 if ( $is_edit || $is_preview ) {
472 auxin_add_hidden_blocks();
473 }
474
475 if ( 'icon' === $settings['type'] ) {
476 $args['has_form'] = false;
477 $args['is_ajax'] = false;
478 $args['toggle_icon_class'] = 'aux-overlay-search';
479
480 } else {
481 $args['has_toggle_icon'] = false;
482 $args['has_category'] = $settings['has_category'];
483
484 switch( $settings['submit_type'] ) {
485 case 'none' :
486 $args['has_submit'] = false;
487 break;
488 case 'icon' :
489 $args['has_submit_icon'] = true;
490 break;
491 case 'button' :
492 $args['has_submit'] = true;
493 break;
494 default :
495 break;
496 }
497
498 }
499
500 $icon_value = ! empty( $settings['aux_search_icon']['value'] ) ? $settings['aux_search_icon'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : 'auxicon-search-4' ) ;
501
502 $args['icon_classname'] = $icon_value;
503 $args['css_class'] = 'aux-search-elementor-element';
504
505 echo auxin_get_search_box( $args );
506 }
507
508 }
509