PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.15.2
Shortcodes and extra features for Phlox theme v2.15.2
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 4 years ago copyright.php 4 years ago current-time.php 4 years ago logo.php 3 years ago menu.php 3 years ago modern-search.php 2 years ago search.php 4 years ago select.php 3 years ago shopping-cart.php 4 years ago site-title.php 3 years ago
search.php
503 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\Schemes\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' => '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 )
227 )
228 );
229
230 $this->add_control(
231 'icon_color',
232 array(
233 'label' => __('Icon color', 'auxin-elements'),
234 'type' => Controls_Manager::COLOR,
235 'default' => '#303030',
236 'selectors' => array(
237 '{{WRAPPER}} .aux-search-icon:before, {{WRAPPER}} .aux-submit-icon-container:before' => 'color: {{VALUE}}',
238 )
239 )
240 );
241
242 $this->add_responsive_control(
243 'icon_margin',
244 array(
245 'label' => __( 'Icon Margin', 'auxin-elements' ),
246 'type' => Controls_Manager::DIMENSIONS,
247 'size_units' => array( 'px', '%' ),
248 'selectors' => array(
249 '{{WRAPPER}} .aux-search-icon, {{WRAPPER}} .aux-submit-icon-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
250 )
251 )
252 );
253
254 $this->end_controls_section();
255
256 /* Icon Section
257 /*-------------------------------------*/
258 $this->start_controls_section(
259 'form_section',
260 array(
261 'label' => __( 'Form', 'auxin-elements' ),
262 'tab' => Controls_Manager::TAB_STYLE,
263 'conditions' => array(
264 'relation' => 'or',
265 'terms' => array(
266 array(
267 'name' => 'type',
268 'operator' => '===',
269 'value' => 'form'
270 )
271 )
272 )
273 )
274 );
275
276 $this->add_group_control(
277 Group_Control_Typography::get_type(),
278 array(
279 'name' => 'form_typgraphy',
280 'scheme' => Typography::TYPOGRAPHY_1,
281 'selector' => '{{WRAPPER}} .aux-search-form .aux-search-field'
282 )
283 );
284
285
286 $this->add_responsive_control(
287 'form_width',
288 array(
289 'label' => __('Width','auxin-elements' ),
290 'type' => Controls_Manager::SLIDER,
291 'size_units' => array('px', 'em','%'),
292 'range' => array(
293 '%' => array(
294 'min' => 1,
295 'max' => 120,
296 'step' => 1
297 ),
298 'em' => array(
299 'min' => 1,
300 'max' => 120,
301 'step' => 1
302 ),
303 'px' => array(
304 'min' => 1,
305 'max' => 1900,
306 'step' => 1
307 )
308 ),
309 'selectors' => array(
310 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'max-width:{{SIZE}}{{UNIT}};'
311 ),
312 )
313 );
314
315 $this->add_responsive_control(
316 'form_margin',
317 array(
318 'label' => __( 'Margin', 'auxin-elements' ),
319 'type' => Controls_Manager::DIMENSIONS,
320 'size_units' => array( 'px', '%' ),
321 'selectors' => array(
322 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
323 )
324 )
325 );
326
327 $this->add_responsive_control(
328 'form_padding',
329 array(
330 'label' => __( 'Padding', 'auxin-elements' ),
331 'type' => Controls_Manager::DIMENSIONS,
332 'size_units' => array( 'px', '%' ),
333 'selectors' => array(
334 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
335 )
336 )
337 );
338
339 $this->add_control(
340 'form_color',
341 array(
342 'label' => __('Form Background Color', 'auxin-elements'),
343 'type' => Controls_Manager::COLOR,
344 'default' => '#FFF',
345 'selectors' => array(
346 '{{WRAPPER}} .aux-search-form .aux-search-field, {{WRAPPER}} .aux-search-form select' => 'background-color: {{VALUE}}',
347 )
348 )
349 );
350
351 $this->add_group_control(
352 Group_Control_Border::get_type(),
353 array(
354 'name' => 'form_border',
355 'selector' => '{{WRAPPER}} .aux-search-form .aux-search-field',
356 'separator' => 'none'
357 )
358 );
359
360 $this->add_control(
361 'form_border_radius',
362 array(
363 'label' => __( 'Border Radius', 'auxin-elements' ),
364 'type' => Controls_Manager::DIMENSIONS,
365 'size_units' => array( 'px', 'em', '%' ),
366 'selectors' => array(
367 '{{WRAPPER}} .aux-search-form .aux-search-field' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow:hidden;'
368 ),
369 'allowed_dimensions' => 'all',
370 'separator' => 'after'
371 )
372 );
373
374 $this->end_controls_section();
375
376 /* Icon Section
377 /*-------------------------------------*/
378 $this->start_controls_section(
379 'button_section',
380 array(
381 'label' => __( 'Button', 'auxin-elements' ),
382 'tab' => Controls_Manager::TAB_STYLE,
383 'conditions' => array(
384 'relation' => 'and',
385 'terms' => array(
386 array(
387 'name' => 'type',
388 'operator' => '===',
389 'value' => 'form'
390 ),
391 array(
392 'name' => 'submit_type',
393 'operator' => '===',
394 'value' => 'button'
395 )
396 )
397 )
398 )
399 );
400
401 $this->add_control(
402 'button_color',
403 array(
404 'label' => __('Background Color', 'auxin-elements'),
405 'type' => Controls_Manager::COLOR,
406 'default' => '#303030',
407 'selectors' => array(
408 '{{WRAPPER}} .aux-search-form .aux-search-submit' => 'background-color: {{VALUE}}',
409 )
410 )
411 );
412
413 $this->add_responsive_control(
414 'button_padding',
415 array(
416 'label' => __( 'Padding', 'auxin-elements' ),
417 'type' => Controls_Manager::DIMENSIONS,
418 'size_units' => array( 'px', '%' ),
419 'selectors' => array(
420 '{{WRAPPER}} .aux-search-form .aux-search-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
421 )
422 )
423 );
424
425 $this->add_responsive_control(
426 'button_margin',
427 array(
428 'label' => __( 'Margin', 'auxin-elements' ),
429 'type' => Controls_Manager::DIMENSIONS,
430 'size_units' => array( 'px', '%' ),
431 'selectors' => array(
432 '{{WRAPPER}} .aux-search-form .aux-search-submit' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
433 )
434 )
435 );
436
437 $this->add_group_control(
438 Group_Control_Typography::get_type(),
439 array(
440 'name' => 'button_typgraphy',
441 'scheme' => Typography::TYPOGRAPHY_1,
442 'selector' => '{{WRAPPER}} .aux-search-form .aux-search-submit'
443 )
444 );
445
446 $this->end_controls_section();
447 }
448
449 /**
450 * Render image box widget output on the frontend.
451 *
452 * Written in PHP and used to generate the final HTML.
453 *
454 * @since 1.0.0
455 * @access protected
456 */
457 protected function render() {
458 $settings = $this->get_settings_for_display();
459
460 $args = [];
461
462 $is_edit = \Elementor\Plugin::instance()->editor->is_edit_mode();
463 $is_preview = isset( $_GET['preview'] ) && $_GET['preview'] ? true : false;
464
465 if ( $is_edit || $is_preview ) {
466 auxin_add_hidden_blocks();
467 }
468
469 if ( 'icon' === $settings['type'] ) {
470 $args['has_form'] = false;
471 $args['is_ajax'] = false;
472 $args['toggle_icon_class'] = 'aux-overlay-search';
473
474 } else {
475 $args['has_toggle_icon'] = false;
476 $args['has_category'] = $settings['has_category'];
477
478 switch( $settings['submit_type'] ) {
479 case 'none' :
480 $args['has_submit'] = false;
481 break;
482 case 'icon' :
483 $args['has_submit_icon'] = true;
484 break;
485 case 'button' :
486 $args['has_submit'] = true;
487 break;
488 default :
489 break;
490 }
491
492 }
493
494 $icon_value = ! empty( $settings['aux_search_icon']['value'] ) ? $settings['aux_search_icon']['value'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : 'auxicon-search-4' ) ;
495
496 $args['icon_classname'] = $icon_value;
497 $args['css_class'] = 'aux-search-elementor-element';
498
499 echo auxin_get_search_box( $args );
500 }
501
502 }
503