PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.1
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.1
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / widgets / header-search / header-search.php
elementskit-lite / widgets / header-search Last commit date
header-search-handler.php 6 months ago header-search.php 3 weeks ago
header-search.php
749 lines
1 <?php
2 namespace Elementor;
3
4 use \Elementor\ElementsKit_Widget_Header_Search_Handler as Handler;
5 use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager;
6
7 defined('ABSPATH') || exit;
8
9 class ElementsKit_Widget_Header_Search extends Widget_Base
10 {
11 use \ElementsKit_Lite\Widgets\Widget_Notice;
12
13 public $base;
14
15 public function __construct( $data = [], $args = null ) {
16 parent::__construct( $data, $args );
17 }
18
19 public function get_style_depends() {
20 return ['magnific-popup', 'ekit-header-search'];
21 }
22
23 public function get_script_depends() {
24 return ['ekit-header-search', 'magnific-popup'];
25 }
26
27
28 public function get_name() {
29 return Handler::get_name();
30 }
31
32 public function get_title() {
33 return Handler::get_title();
34 }
35
36 public function get_icon() {
37 return Handler::get_icon();
38 }
39
40 public function get_categories() {
41 return Handler::get_categories();
42 }
43
44 public function get_keywords() {
45 return Handler::get_keywords();
46 }
47
48 public function get_help_url() {
49 return 'https://wpmet.com/doc/search-2/';
50 }
51
52 protected function is_dynamic_content(): bool {
53 return false;
54 }
55
56 public function has_widget_inner_wrapper(): bool {
57 return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
58 }
59
60 protected function register_controls()
61 {
62
63 $this->start_controls_section(
64 'ekit_header_search',
65 [
66 'label' => esc_html__('Header Search', 'elementskit-lite'),
67 ]
68 );
69
70 $this->add_control(
71 'ekit_search_placeholder_text', [
72 'label' => esc_html__('Placeholder Text', 'elementskit-lite'),
73 'type' => Controls_Manager::TEXT,
74 'dynamic' => [
75 'active' => true,
76 ],
77 'default' => 'Search...',
78 'label_block' => true,
79 ]
80 );
81
82
83 $this->add_control(
84 'ekit_search_icons',
85 [
86 'label' => esc_html__('Select Icon', 'elementskit-lite'),
87 'fa4compatibility' => 'ekit_search_icon',
88 'default' => [
89 'value' => 'icon icon-search',
90 'library' => 'ekiticons',
91 ],
92 'label_block' => true,
93 'type' => Controls_Manager::ICONS,
94
95 ]
96 );
97
98 $this->add_responsive_control(
99 'ekit_search_icon_font_size',
100 [
101 'label' => esc_html__('Font Size', 'elementskit-lite'),
102 'type' => Controls_Manager::SLIDER,
103 'size_units' => ['px', 'em'],
104 'default' => [
105 'unit' => 'px',
106 'size' => '20',
107 ],
108 'selectors' => [
109 '{{WRAPPER}} .ekit_navsearch-button :is(i, svg)' => 'font-size: {{SIZE}}{{UNIT}};',
110 ],
111
112 ]
113 );
114
115 $this->end_controls_section();
116
117
118 $this->start_controls_section(
119 'ekit_header_search_section_tab_style',
120 [
121 'label' => esc_html__('Header Search', 'elementskit-lite'),
122 'tab' => Controls_Manager::TAB_STYLE,
123 ]
124 );
125
126 $this->start_controls_tabs( 'ekit_search_tab_search_tabs' );
127 $this->start_controls_tab(
128 'ekit_search_tab_search_normal',
129 [
130 'label' =>esc_html__( 'Normal', 'elementskit-lite' ),
131 ]
132 );
133 $this->add_control(
134 'ekit_searech_icon_color',
135 [
136 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
137 'type' => Controls_Manager::COLOR,
138 'selectors' => [
139 '{{WRAPPER}} .ekit_navsearch-button, {{WRAPPER}} .ekit_search-button' => 'color: {{VALUE}}; fill: {{VALUE}};',
140 ],
141 ]
142 );
143
144 $this->add_control(
145 'ekit_seacrh_icon_bg_color',
146 [
147 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
148 'type' => Controls_Manager::COLOR,
149 'selectors' => [
150 '{{WRAPPER}} .ekit_navsearch-button' => 'background-color: {{VALUE}};',
151 ],
152 ]
153 );
154 $this->end_controls_tab();
155
156 $this->start_controls_tab(
157 'ekit_search_tab_search_hover',
158 [
159 'label' =>esc_html__( 'Hover', 'elementskit-lite' ),
160 ]
161 );
162 $this->add_control(
163 'ekit_searech_icon_hover_color',
164 [
165 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
166 'type' => Controls_Manager::COLOR,
167 'selectors' => [
168 '{{WRAPPER}} .ekit_navsearch-button:hover, {{WRAPPER}} .ekit_search-button:hover' => 'color: {{VALUE}}; fill: {{VALUE}};',
169 ],
170 ]
171 );
172
173 $this->add_control(
174 'ekit_seacrh_icon_hover_bg_color',
175 [
176 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
177 'type' => Controls_Manager::COLOR,
178 'selectors' => [
179 '{{WRAPPER}} .ekit_navsearch-button:hover' => 'background-color: {{VALUE}};',
180 ],
181 ]
182 );
183 $this->end_controls_tab();
184 $this->end_controls_tabs();
185
186 $this->add_group_control(
187 Group_Control_Border::get_type(),
188 [
189 'name' => 'ekit_border',
190 'selector' => '{{WRAPPER}} .ekit_navsearch-button',
191 'separator' => 'before',
192 ]
193 );
194
195 // box shadow
196 $this->add_group_control(
197 Group_Control_Box_Shadow::get_type(), [
198 'name' => 'ekit_header_search',
199 'selector' => '{{WRAPPER}} .ekit_navsearch-button',
200 ]
201 );
202 // border radius
203 $this->add_control(
204 'ekit_header_border_radius',
205 [
206 'label' => esc_html__( 'Border radius', 'elementskit-lite' ),
207 'type' => Controls_Manager::DIMENSIONS,
208 'size_units' => [ 'px', '%', 'em' ],
209 'selectors' => [
210 '{{WRAPPER}} .ekit_navsearch-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
211 ],
212 ]
213 );
214
215 $this->add_responsive_control(
216 'ekit_search_margin',
217 [
218 'label' => esc_html__('Margin', 'elementskit-lite'),
219 'type' => Controls_Manager::DIMENSIONS,
220 'size_units' => ['px', 'em'],
221 'default' => [
222 'top' => '5',
223 'right' => '5',
224 'bottom' => '5' ,
225 'left' => '5',
226 ],
227 'selectors' => [
228 '{{WRAPPER}} .ekit_navsearch-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
229 ],
230 ]
231 );
232
233 $this->add_control(
234 'ekit_search_padding',
235 [
236 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
237 'type' => Controls_Manager::DIMENSIONS,
238 'size_units' => [ 'px', '%', 'em' ],
239 'default' => [
240 'top' => '0',
241 'right' => '0',
242 'bottom' => '0' ,
243 'left' => '0',
244 ],
245 'selectors' => [
246 '{{WRAPPER}} .ekit_navsearch-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
247 ],
248 ]
249 );
250
251
252 $this->add_control(
253 'ekit_search_height_width_socher',
254 [
255 'label' => esc_html__( 'Use Height Width', 'elementskit-lite' ),
256 'type' => Controls_Manager::SWITCHER,
257 'label_on' => esc_html__( 'Show', 'elementskit-lite' ),
258 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ),
259 'return_value' => 'yes',
260 'default' => 'yes',
261 ]
262 );
263
264 $this->add_responsive_control(
265 'ekit_search_width',
266 [
267 'label' => esc_html__('Width', 'elementskit-lite'),
268 'type' => Controls_Manager::SLIDER,
269 'size_units' => ['px', 'em', '%'],
270 'default' => [
271 'unit' => 'px',
272 'size' => '40',
273 ],
274 'selectors' => [
275 '{{WRAPPER}} .ekit_navsearch-button' => 'width: {{SIZE}}{{UNIT}};',
276 ],
277 'condition' => [
278 'ekit_search_height_width_socher' => 'yes'
279 ]
280 ]
281 );
282 $this->add_responsive_control(
283 'ekit_search_height',
284 [
285 'label' => esc_html__('Height', 'elementskit-lite'),
286 'type' => Controls_Manager::SLIDER,
287 'size_units' => ['px', 'em', '%'],
288 'default' => [
289 'unit' => 'px',
290 'size' => '40',
291 ],
292 'selectors' => [
293 '{{WRAPPER}} .ekit_navsearch-button' => 'height: {{SIZE}}{{UNIT}};',
294 ],
295 'condition' => [
296 'ekit_search_height_width_socher' => 'yes'
297 ]
298 ]
299 );
300 $this->add_responsive_control(
301 'ekit_search_line_height',
302 [
303 'label' => esc_html__('Line Height', 'elementskit-lite'),
304 'type' => Controls_Manager::SLIDER,
305 'size_units' => ['px', 'em', '%'],
306 'default' => [
307 'unit' => 'px',
308 'size' => '40',
309 ],
310 'selectors' => [
311 '{{WRAPPER}} .ekit_navsearch-button' => 'line-height: {{SIZE}}{{UNIT}};',
312 ],
313 'condition' => [
314 'ekit_search_height_width_socher' => 'yes'
315 ]
316 ]
317 );
318
319 $this->add_responsive_control(
320 'ekit_search_icon_text_align',
321 [
322 'label' => esc_html__( 'Alignment', 'elementskit-lite' ),
323 'type' => Controls_Manager::CHOOSE,
324 'options' => [
325 'left' => [
326 'title' => esc_html__( 'Left', 'elementskit-lite' ),
327 'icon' => 'eicon-text-align-left',
328 ],
329 'center' => [
330 'title' => esc_html__( 'Center', 'elementskit-lite' ),
331 'icon' => 'eicon-text-align-center',
332 ],
333 'right' => [
334 'title' => esc_html__( 'Right', 'elementskit-lite' ),
335 'icon' => 'eicon-text-align-right',
336 ],
337 ],
338 'default' => 'center',
339 'toggle' => true,
340 'selectors' => [
341 '{{WRAPPER}} .ekit_navsearch-button' => 'text-align: {{VALUE}};',
342 ],
343 ]
344 );
345
346 $this->end_controls_section();
347
348 $this->start_controls_section(
349 'ekit_search_container_style_tabs',
350 [
351 'label' => __( 'Search Container', 'elementskit-lite' ),
352 'tab' => Controls_Manager::TAB_STYLE,
353 ]
354 );
355
356 $this->add_group_control(
357 Group_Control_Background::get_type(),
358 [
359 'name' => 'ekit_search_backdrop_background',
360 'label' => __( 'Background', 'elementskit-lite' ),
361 'types' => [ 'classic', 'gradient' ],
362 'selector' => '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group input:not([type="submit"])',
363 ]
364 );
365
366 $this->add_responsive_control(
367 'ekit_search_content_title_color',
368 [
369 'label' => __( 'Color', 'elementskit-lite' ),
370 'type' => Controls_Manager::COLOR,
371 'selectors' => [
372 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group input:not([type=submit]), .ekit-popup-{{ID}} button.mfp-close' => 'border-color: {{VALUE}}',
373 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-button, .ekit-popup-{{ID}} .ekit-promo-popup .mfp-close, .ekit-popup-{{ID}} .ekit_search-field' => 'color: {{VALUE}}',
374 ],
375 ]
376 );
377
378 $this->add_responsive_control(
379 'ekit_search_placeholder_title_color',
380 [
381 'label' => __( 'Placeholder Color', 'elementskit-lite' ),
382 'type' => Controls_Manager::COLOR,
383 'selectors' => [
384 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-field::-webkit-input-placeholder' => 'color: {{VALUE}}',
385 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-field::-moz-placeholder' => 'color: {{VALUE}}',
386 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-field:-ms-input-placeholder' => 'color: {{VALUE}}',
387 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-field:-moz-placeholder' => 'color: {{VALUE}}',
388 ],
389 ]
390 );
391
392 $this->add_group_control(
393 Group_Control_Typography::get_type(),
394 [
395 'name' => 'ekit_search_input_typography',
396 'label' => esc_html__( 'Typography', 'elementskit-lite' ),
397 'exclude' => [ 'line_height', 'text_decoration', 'text_transform', 'font_style' ],
398 'selector' => '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit_search-field',
399 ]
400 );
401 $this->add_control(
402 'ekit_search_border_heading',
403 [
404 'label' => esc_html__( 'Border', 'elementskit-lite' ),
405 'type' => \Elementor\Controls_Manager::HEADING,
406 'separator' => 'before',
407 ]
408 );
409
410 $this->add_group_control(
411 Group_Control_Border::get_type(),
412 [
413 'name' => 'ekit_search_border',
414 'label' => esc_html__( 'Border Type', 'elementskit-lite' ),
415 'default' =>'',
416 'selector' => '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group input:not([type="submit"])',
417 ]
418 );
419
420 $this->add_control(
421 'ekit_search_border_radius',
422 [
423 'label' => esc_html__( 'Border radius', 'elementskit-lite' ),
424 'type' => Controls_Manager::DIMENSIONS,
425 'size_units' => [ 'px', '%', 'em' ],
426 'selectors' => [
427 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group input:not([type="submit"])' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
428 ],
429 'separator' => 'after',
430 ]
431 );
432
433 $this->add_control(
434 'ekit_search_input_height',
435 [
436 'label' => esc_html__( 'Height (px)', 'elementskit-lite' ),
437 'type' => Controls_Manager::SLIDER,
438 'size_units' => [ 'px' ],
439 'range' => [
440 'px' => [
441 'min' => 0,
442 'max' => 100,
443 'step' => 1,
444 ],
445 ],
446 'selectors' => [
447 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group input:not([type="submit"])' => 'height: {{SIZE}}{{UNIT}};',
448 ],
449 ]
450 );
451
452 $this->add_control(
453 'ekit_search_input_width',
454 [
455 'label' => esc_html__( 'Width', 'elementskit-lite' ),
456 'type' => Controls_Manager::SLIDER,
457 'size_units' => [ 'px' ],
458 'range' => [
459 'px' => [
460 'min' => 350,
461 'max' => 900
462 ],
463 ],
464 'selectors' => [
465 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-panel' => 'max-width: {{SIZE}}{{UNIT}};',
466 ],
467 ]
468 );
469
470 $this->add_control(
471 'ekit_search_input_icon_size',
472 [
473 'label' => esc_html__('Icon Size (px)', 'elementskit-lite'),
474 'type' => Controls_Manager::SLIDER,
475 'size_units' => ['px'],
476 'range' => [
477 'px' => [
478 'min' => 10,
479 'max' => 150,
480 'step' => 1,
481 ],
482 ],
483 'selectors' => [
484 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-button i' => 'font-size: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
485 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-button svg' => 'font-size: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};',
486 ],
487 ]
488 );
489
490 $this->add_control(
491 'ekit_search_input_left',
492 [
493 'label' => esc_html__( 'Icon Left Position (px)', 'elementskit-lite' ),
494 'type' => Controls_Manager::SLIDER,
495 'size_units' => [ 'px' ],
496 'range' => [
497 'px' => [
498 'min' => 0,
499 'max' => 100,
500 'step' => 1,
501 ],
502 ],
503 'selectors' => [
504 '.ekit-popup-{{ID}} .ekit_modal-searchPanel .ekit-search-group .ekit_search-button' => 'right: {{SIZE}}{{UNIT}};',
505 ],
506 ]
507 );
508
509 $this->add_control(
510 'ekit_search_background_overlay_color',
511 [
512 'label' => esc_html__( 'Background Overlay Color', 'elementskit-lite' ),
513 'type' => \Elementor\Controls_Manager::COLOR,
514 'selectors' => [
515 '.ekit-popup-{{ID}} ' => 'background-color: {{VALUE}}',
516 ],
517 'separator' => 'before',
518 ]
519 );
520
521 $this->add_control(
522 'ekit_search_box_align',
523 [
524 'label' => esc_html__( 'Alignment', 'elementskit-lite' ),
525 'type' => Controls_Manager::CHOOSE,
526 'options' => [
527 'top' => [
528 'title' => esc_html__( 'Top', 'elementskit-lite' ),
529 'icon' => 'eicon-v-align-top',
530 ],
531 'middle' => [
532 'title' => esc_html__( 'Middle', 'elementskit-lite' ),
533 'icon' => 'eicon-v-align-middle',
534 ],
535 'bottom' => [
536 'title' => esc_html__( 'Bottom', 'elementskit-lite' ),
537 'icon' => 'eicon-v-align-bottom',
538 ],
539 ],
540 'toggle' => true,
541 'selectors' => [
542 '.ekit-popup-{{ID}} > .mfp-container > .mfp-content' => 'vertical-align: {{VALUE}};',
543 ],
544 ]
545 );
546
547 $this->add_control(
548 'ekit_search_box_padding',
549 [
550 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
551 'type' => Controls_Manager::DIMENSIONS,
552 'size_units' => [ 'px', '%', 'em' ],
553 'selectors' => [
554 '.ekit-popup-{{ID}} > .mfp-container > .mfp-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
555 ],
556 ]
557 );
558
559 $this->end_controls_section();
560
561 $this->start_controls_section(
562 'ekit_search_close_button_style_tabs',
563 [
564 'label' => __( 'Close Button', 'elementskit-lite' ),
565 'tab' => Controls_Manager::TAB_STYLE,
566 ]
567 );
568
569 $this->add_responsive_control(
570 'ekit_search_close_button_border_radius',
571 [
572 'label' => esc_html__('Border Radius', 'elementskit-lite'),
573 'type' => Controls_Manager::SLIDER,
574 'size_units' => ['%', 'px'],
575 'default' => [
576 'unit' => '%'
577 ],
578 'range' => [
579 'min' => 0,
580 'max' => 100,
581 ],
582 'selectors' => [
583 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close' => 'border-radius: {{SIZE}}{{UNIT}};',
584 ],
585
586 ]
587 );
588
589 $this->add_responsive_control(
590 'ekit_search_close_button_size',
591 [
592 'label' => esc_html__('Size (px)', 'elementskit-lite'),
593 'type' => Controls_Manager::SLIDER,
594 'size_units' => ['px'],
595 'range' => [
596 'px' => [
597 'min' => 30,
598 'max' => 50,
599 ],
600 ],
601 'selectors' => [
602 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
603 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close:hover' => 'width: {{SIZE}}{{UNIT}};',
604 ],
605
606 ]
607 );
608
609 $this->start_controls_tabs( 'ekit_search_close_button_tabs' );
610
611 $this->start_controls_tab(
612 'ekit_search_close_button_normal',
613 [
614 'label' =>esc_html__( 'Normal', 'elementskit-lite' ),
615 ]
616 );
617
618 $this->add_control(
619 'ekit_search_close_button_color',
620 [
621 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
622 'type' => Controls_Manager::COLOR,
623 'selectors' => [
624 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close' => 'color: {{VALUE}}; border-color: {{VALUE}}',
625 ],
626 ]
627 );
628
629 $this->add_control(
630 'ekit_search_close_button_bg_color',
631 [
632 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
633 'type' => Controls_Manager::COLOR,
634 'selectors' => [
635 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close' => 'background-color: {{VALUE}};',
636 ],
637 ]
638 );
639 $this->end_controls_tab();
640
641 $this->start_controls_tab(
642 'ekit_search_close_button_hover',
643 [
644 'label' =>esc_html__( 'Hover', 'elementskit-lite' ),
645 ]
646 );
647
648 $this->add_control(
649 'ekit_search_close_button_hover_color',
650 [
651 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
652 'type' => Controls_Manager::COLOR,
653 'selectors' => [
654 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close:hover' => 'color: {{VALUE}}; border-color: {{VALUE}}',
655 ],
656 ]
657 );
658
659 $this->add_control(
660 'ekit_search_close_button_hover_bg_color',
661 [
662 'label' =>esc_html__( 'Background Color', 'elementskit-lite' ),
663 'type' => Controls_Manager::COLOR,
664 'selectors' => [
665 '.ekit-popup-{{ID}}.ekit-promo-popup .mfp-close:hover' => 'background-color: {{VALUE}};',
666 ],
667 ]
668 );
669 $this->end_controls_tab();
670
671 $this->end_controls_tabs();
672
673 $this->end_controls_section();
674
675 $this->insert_pro_message();
676 }
677
678
679 protected function render( ) {
680 echo '<div class="ekit-wid-con" >';
681 $this->render_raw();
682 echo '</div>';
683 }
684
685 protected function render_raw( ) {
686 $settings = $this->get_settings();
687 /*
688 *
689 * Roots.io searchform.php template hack to fix Polylang search
690 * https://gist.github.com/bramchi/d0767c32a772550486ea
691 * Note: Polylang setting 'Hide URL language info for default language' should be enabled for this to work.
692 * Soil-nice-search disabled in Roots.
693 *
694 */
695 $language_prefix = (!function_exists('pll_current_language') ? '' : pll_current_language());
696
697 $ekit_search_link = apply_filters('ekit_search_link', home_url( '/'.$language_prefix ));
698 $placeholder_and_label = $settings['ekit_search_placeholder_text'];
699 // Persistent accessible name for the search field: reuse the placeholder text
700 // when set (placeholders alone are an unreliable label), otherwise "Search".
701 $ekit_search_field_label = ( '' !== trim( (string) $placeholder_and_label ) ) ? $placeholder_and_label : esc_html__( 'Search', 'elementskit-lite' );
702 ?>
703 <a href="#ekit_modal-popup-<?php echo esc_attr($this->get_id()); ?>" class="ekit_navsearch-button ekit-modal-popup" role="button" aria-haspopup="dialog" aria-label="<?php echo esc_attr__( 'Search', 'elementskit-lite' ); ?>">
704 <?php
705 // new icon
706 $migrated = isset( $settings['__fa4_migrated']['ekit_search_icons'] );
707 // Check if its a new widget without previously selected icon using the old Icon control
708 $is_new = empty( $settings['ekit_search_icon'] );
709 if ( $is_new || $migrated ) {
710 // new icon
711 Icons_Manager::render_icon( $settings['ekit_search_icons'], [ 'aria-hidden' => 'true' ] );
712 } else {
713 ?>
714 <i class="<?php echo esc_attr($settings['ekit_search_icon']); ?>" aria-hidden="true"></i>
715 <?php
716 }
717 ?>
718 </a>
719 <!-- language switcher strart -->
720 <!-- xs modal -->
721 <div class="zoom-anim-dialog mfp-hide ekit_modal-searchPanel" id="ekit_modal-popup-<?php echo esc_attr($this->get_id()); ?>" role="dialog" aria-modal="true" aria-label="<?php echo esc_attr__( 'Search', 'elementskit-lite' ); ?>">
722 <div class="ekit-search-panel">
723 <!-- Polylang search - thanks to Alain Melsens -->
724 <form role="search" method="get" class="ekit-search-group" action="<?php echo esc_url( $ekit_search_link ); ?>">
725 <input type="search" class="ekit_search-field" aria-label="<?php echo esc_attr($ekit_search_field_label); ?>" placeholder="<?php echo esc_attr($placeholder_and_label); ?>" value="<?php echo esc_attr(get_search_query()); ?>" name="s">
726 <button type="submit" class="ekit_search-button" aria-label="<?php echo esc_attr__( 'Search', 'elementskit-lite' ); ?>">
727 <?php
728 // new icon
729 $migrated = isset( $settings['__fa4_migrated']['ekit_search_icons'] );
730 // Check if its a new widget without previously selected icon using the old Icon control
731 $is_new = empty( $settings['ekit_search_icon'] );
732 if ( $is_new || $migrated ) {
733 // new icon
734 Icons_Manager::render_icon( $settings['ekit_search_icons'], [ 'aria-hidden' => 'true' ] );
735 } else {
736 ?>
737 <i class="<?php echo esc_attr($settings['ekit_search_icon']); ?>" title="Search" aria-hidden="true"></i>
738 <?php
739 }
740 ?>
741 </button>
742 </form>
743 </div>
744 </div><!-- End xs modal -->
745 <!-- end language switcher strart -->
746 <?php
747 }
748 }
749