PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 All 30 releases
← All changes | includes/Elementor/Search.php +787 -597 1.2.6 → 2.5.0 View file →
@@ -1,598 +1,788 @@
1 -<?php
2 -
3 -namespace admin\Elementor;
4 -
5 -use Elementor\Controls_Manager;
6 -use Elementor\Group_Control_Typography;
7 -use Elementor\Widget_Base;
8 -use Elementor\Group_Control_Border;
9 -
10 -// Exit if accessed directly
11 -if ( ! defined( 'ABSPATH' ) ) {
12 - exit;
13 -}
14 -
15 -class Search extends Widget_Base {
16 - public function get_name() {
17 - return 'ama_search';
18 - }
19 -
20 - public function get_title() {
21 - return esc_html__( 'BBPC Search', 'bbp-core' );
22 - }
23 -
24 - public function get_icon() {
25 - return 'bbpc_icon_ama_search';
26 - }
27 -
28 - public function get_style_depends() {
29 - return [ 'ama-core-style', 'bbpc-el-widgets' ];
30 - }
31 -
32 - public function get_script_depends() {
33 - return [ 'bbpc-frontend-js', 'bbpc-frontend-js' ];
34 - }
35 -
36 - public function get_categories() {
37 - return [ 'bbp-core' ];
38 - }
39 -
40 - protected function register_controls() {
41 -
42 - $this->start_controls_section(
43 - 'search_form_sec', [
44 - 'label' => esc_html__( 'Form', 'bbp-core' ),
45 - ]
46 - );
47 -
48 - $this->add_control(
49 - 'placeholder', [
50 - 'label' => esc_html__( 'Placeholder', 'bbp-core' ),
51 - 'type' => Controls_Manager::TEXT,
52 - 'label_block' => true,
53 - 'default' => 'Search for Topics....',
54 - ]
55 - );
56 -
57 - // select controls
58 - $this->add_control(
59 - 'submit_btn_type', [
60 - 'label' => __( 'Search Type', 'bbp-core' ),
61 - 'type' => \Elementor\Controls_Manager::SELECT,
62 - 'default' => 'icon',
63 - 'options' => [
64 - 'icon' => __( 'Icon', 'bbp-core' ),
65 - 'text' => __( 'Text', 'bbp-core' )
66 - ],
67 - ]
68 - );
69 -
70 - $this->add_control(
71 - 'submit_btn_icon', [
72 - 'label' => __( 'Submit Button Icon', 'bbp-core' ),
73 - 'type' => \Elementor\Controls_Manager::ICONS,
74 - 'default' => [
75 - 'value' => 'fas fa-search',
76 - 'library' => 'solid',
77 - ],
78 - 'condition' => [
79 - 'submit_btn_type' => 'icon'
80 - ]
81 - ]
82 - );
83 -
84 - $this->add_control(
85 - 'submit_btn_text', [
86 - 'label' => esc_html__( 'Submit Button Text', 'bbp-core' ),
87 - 'type' => Controls_Manager::TEXT,
88 - 'label_block' => true,
89 - 'default' => __( 'Search', 'bbp-core' ),
90 - 'condition' => [
91 - 'submit_btn_type' => 'text'
92 - ]
93 - ]
94 - );
95 -
96 - $this->add_control(
97 - 'submit_btn_align', [
98 - 'label' => __( 'Submit Alignment', 'bbp-core' ),
99 - 'type' => \Elementor\Controls_Manager::CHOOSE,
100 - 'options' => [
101 - 'right' => [
102 - 'title' => __( 'Left', 'bbp-core' ),
103 - 'icon' => 'fa fa-align-left',
104 - ],
105 - 'left' => [
106 - 'title' => __( 'Right', 'bbp-core' ),
107 - 'icon' => 'fa fa-align-right',
108 - ],
109 - ],
110 - 'toggle' => false,
111 - 'default' => 'left'
112 - ]
113 - );
114 -
115 - $this->add_control(
116 - 'is_keywords', [
117 - 'label' => esc_html__( 'Keywords', 'bbp-core' ),
118 - 'type' => \Elementor\Controls_Manager::SWITCHER,
119 - 'return_value' => 'yes',
120 - 'default' => 'yes',
121 - 'separator' => 'before',
122 - ]
123 - );
124 -
125 - $this->add_control(
126 - 'keywords_label',
127 - [
128 - 'label' => esc_html__( 'Keywords Label', 'bbp-core' ),
129 - 'type' => Controls_Manager::TEXT,
130 - 'label_block' => true,
131 - 'default' => 'Popular:',
132 - 'condition' => [
133 - 'is_keywords' => 'yes'
134 - ]
135 - ]
136 - );
137 -
138 - $this->add_control(
139 - 'keywords_align', [
140 - 'label' => __( 'Keywords Alignment', 'bbp-core' ),
141 - 'type' => \Elementor\Controls_Manager::CHOOSE,
142 - 'options' => [
143 - 'left' => [
144 - 'title' => __( 'Left', 'bbp-core' ),
145 - 'icon' => 'fa fa-align-left',
146 - ],
147 - 'center' => [
148 - 'title' => __( 'Center', 'bbp-core' ),
149 - 'icon' => 'fa fa-align-center',
150 - ],
151 - 'right' => [
152 - 'title' => __( 'Right', 'bbp-core' ),
153 - 'icon' => 'fa fa-align-right',
154 - ],
155 - ],
156 - 'toggle' => false,
157 - 'default' => 'center'
158 - ]
159 - );
160 -
161 - $keywords = new \Elementor\Repeater();
162 -
163 - $keywords->add_control(
164 - 'title', [
165 - 'label' => __( 'Title', 'bbp-core' ),
166 - 'type' => \Elementor\Controls_Manager::TEXT,
167 - 'label_block' => true,
168 - ]
169 - );
170 -
171 - $this->add_control(
172 - 'keywords',
173 - [
174 - 'label' => __( 'Repeater List', 'bbp-core' ),
175 - 'type' => \Elementor\Controls_Manager::REPEATER,
176 - 'fields' => $keywords->get_controls(),
177 - 'default' => [
178 - [
179 - 'title' => __( 'Keyword #1', 'bbp-core' ),
180 - ],
181 - [
182 - 'title' => __( 'Keyword #2', 'bbp-core' ),
183 - ],
184 - ],
185 - 'title_field' => '{{{ title }}}',
186 - 'prevent_empty' => false,
187 - 'condition' => [
188 - 'is_keywords' => 'yes'
189 - ]
190 - ]
191 - );
192 -
193 - $this->end_controls_section();
194 -
195 - /**
196 - * Style Keywords
197 - * Global
198 - */
199 - $this->start_controls_section(
200 - 'style_form', [
201 - 'label' => esc_html__( 'Form', 'bbp-core' ),
202 - 'tab' => Controls_Manager::TAB_STYLE,
203 - ]
204 - );
205 -
206 - $this->add_control(
207 - 'input_heading_form', [
208 - 'label' => esc_html__( 'Input', 'bbp-core' ),
209 - 'type' => Controls_Manager::HEADING
210 - ]
211 - );
212 -
213 - $this->add_control(
214 - 'color_text', [
215 - 'label' => esc_html__( 'Text Color', 'bbp-core' ),
216 - 'type' => Controls_Manager::COLOR,
217 - 'selectors' => [
218 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'color: {{VALUE}};',
219 - ]
220 - ]
221 - );
222 -
223 - $this->add_control(
224 - 'color_placeholder', [
225 - 'label' => esc_html__( 'Placeholder Color', 'bbp-core' ),
226 - 'type' => Controls_Manager::COLOR,
227 - 'selectors' => [
228 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input::placeholder' => 'color: {{VALUE}};',
229 - ],
230 - ]
231 - );
232 -
233 - $this->add_group_control(
234 - Group_Control_Border::get_type(), [
235 - 'name' => 'input_border',
236 - 'label' => esc_html__( 'Border', 'bbp-core' ),
237 - 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input',
238 - ]
239 - );
240 -
241 - $this->add_control(
242 - 'input_bg_color', [
243 - 'label' => esc_html__( 'Background Color', 'bbp-core' ),
244 - 'type' => Controls_Manager::COLOR,
245 - 'selectors' => [
246 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'background-color: {{VALUE}};',
247 - ],
248 - ]
249 - );
250 -
251 - $this->add_group_control(
252 - Group_Control_Typography::get_type(), [
253 - 'name' => 'typography_placeholder',
254 - 'label' => esc_html__( 'Typography', 'bbp-core' ),
255 - 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input::placeholder, .bbpc_search_form_wrapper .input-wrapper input',
256 - ]
257 - );
258 -
259 - $this->add_responsive_control(
260 - 'input-padding', [
261 - 'label' => esc_html__( 'Padding', 'bbp-core' ),
262 - 'type' => Controls_Manager::DIMENSIONS,
263 - 'size_units' => [ 'px', '%', 'em' ],
264 - 'selectors' => [
265 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
266 - ]
267 - ]
268 - );
269 -
270 - $this->add_responsive_control(
271 - 'input-border-radius', [
272 - 'label' => __( 'Border Radius', 'bbp-core' ),
273 - 'type' => Controls_Manager::DIMENSIONS,
274 - 'size_units' => [ 'px', '%', 'em' ],
275 - 'selectors' => [
276 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
277 - ],
278 - ]
279 - );
280 -
281 - $this->add_control(
282 - 'submit_heading_form', [
283 - 'label' => esc_html__( 'Submit', 'bbp-core' ),
284 - 'type' => Controls_Manager::HEADING,
285 - 'separator' => 'before'
286 - ]
287 - );
288 -
289 - $this->add_control(
290 - 'color_icon', [
291 - 'label' => esc_html__( 'Button Color', 'bbp-core' ),
292 - 'type' => Controls_Manager::COLOR,
293 - 'selectors' => [
294 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'color: {{VALUE}};',
295 - ],
296 - ]
297 - );
298 -
299 -
300 - $this->add_control(
301 - 'search_bg',
302 - [
303 - 'label' => __( 'Background', 'bbp-core' ),
304 - 'type' => \Elementor\Controls_Manager::COLOR,
305 - 'selectors' => [
306 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'background: {{VALUE}}',
307 - ],
308 - ]
309 - );
310 -
311 - $this->add_responsive_control(
312 - 'btn-padding', [
313 - 'label' => esc_html__( 'Padding', 'bbp-core' ),
314 - 'type' => Controls_Manager::DIMENSIONS,
315 - 'size_units' => [ 'px', '%', 'em' ],
316 - 'selectors' => [
317 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
318 - ]
319 - ]
320 - );
321 -
322 - $this->add_responsive_control(
323 - 'btn-border-radius', [
324 - 'label' => __( 'Border Radius', 'bbp-core' ),
325 - 'type' => Controls_Manager::DIMENSIONS,
326 - 'size_units' => [ 'px', '%', 'em' ],
327 - 'selectors' => [
328 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
329 - ],
330 - ]
331 - );
332 -
333 - // slider controls
334 - $this->add_control(
335 - 'typography_btn', [
336 - 'label' => esc_html__( 'Icon Size', 'bbp-core' ),
337 - 'type' => Controls_Manager::SLIDER,
338 - 'range' => [
339 - 'px' => [
340 - 'min' => 10,
341 - 'max' => 100,
342 - ],
343 - ],
344 - 'selectors' => [
345 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button i' => 'font-size: {{SIZE}}{{UNIT}};'
346 - ],
347 - 'condition' => [
348 - 'submit_btn_type' => 'icon'
349 - ],
350 - ]
351 - );
352 -
353 -
354 - // slider controls
355 - $this->add_control(
356 - 'submit_btn_align_left', [
357 - 'label' => esc_html__( 'Spacing', 'bbp-core' ),
358 - 'type' => Controls_Manager::SLIDER,
359 - 'range' => [
360 - 'px' => [
361 - 'min' => 10,
362 - 'max' => 100,
363 - ],
364 - ],
365 - 'selectors' => [
366 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-left' => 'right: {{SIZE}}{{UNIT}};',
367 - ],
368 - 'condition' => [
369 - 'submit_btn_align' => 'left'
370 - ],
371 - ]
372 - );
373 -
374 -
375 - // slider controls
376 - $this->add_control(
377 - 'submit_btn_align_right', [
378 - 'label' => esc_html__( 'Spacing', 'bbp-core' ),
379 - 'type' => Controls_Manager::SLIDER,
380 - 'range' => [
381 - 'px' => [
382 - 'min' => 10,
383 - 'max' => 100,
384 - ],
385 - ],
386 - 'selectors' => [
387 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-right' => 'left: {{SIZE}}{{UNIT}};',
388 - ],
389 - 'condition' => [
390 - 'submit_btn_align' => 'right'
391 - ],
392 - ]
393 - );
394 -
395 - // typography controls
396 - $this->add_group_control(
397 - Group_Control_Typography::get_type(), [
398 - 'name' => 'typography_btn',
399 - 'label' => esc_html__( 'Typography', 'bbp-core' ),
400 - 'condition' => [
401 - 'submit_btn_type' => 'text'
402 - ],
403 - 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button',
404 - ]
405 - );
406 -
407 - $this->end_controls_section();
408 -
409 - $this->start_controls_section(
410 - 'style_keywords', [
411 - 'label' => esc_html__( 'Keywords', 'bbp-core' ),
412 - 'tab' => Controls_Manager::TAB_STYLE,
413 - ]
414 - );
415 -
416 - $this->add_control(
417 - 'margin_keywords', [
418 - 'label' => __( 'Margin', 'bbp-core' ),
419 - 'description' => __( 'Margin around the keywords block', 'bbp-core' ),
420 - 'type' => Controls_Manager::DIMENSIONS,
421 - 'size_units' => [ 'px', '%', 'em' ],
422 - 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
423 - 'separator' => 'before',
424 - 'default' => [
425 - 'unit' => 'px',
426 - ],
427 - ]
428 - );
429 -
430 - $this->add_control(
431 - 'color_keywords_label', [
432 - 'label' => esc_html__( 'Label Color', 'bbp-core' ),
433 - 'type' => Controls_Manager::COLOR,
434 - 'selectors' => [
435 - '{{WRAPPER}} .bbpc-search-keyword span.bbpc-search-keywords-label' => 'color: {{VALUE}};',
436 - ],
437 - ]
438 - );
439 -
440 - $this->add_group_control(
441 - \Elementor\Group_Control_Typography::get_type(),
442 - [
443 - 'name' => 'keyword_label_typography',
444 - 'label' => __( 'Label Typography', 'bbp-core' ),
445 - 'selector' => '{{WRAPPER}} .bbpc-search-keyword span.bbpc-search-keywords-label',
446 - ]
447 - );
448 -
449 - $this->start_controls_tabs(
450 - 'bbpc_tabs_keywords_style'
451 - );
452 -
453 - $this->start_controls_tab(
454 - 'bbpc_keywords_style',
455 - [
456 - 'label' => esc_html__( 'Normal', 'bbp-core' ),
457 - ]
458 - );
459 -
460 - $this->add_control(
461 - 'bbpc_color_keywords', [
462 - 'label' => esc_html__( 'Keyword Color', 'bbp-core' ),
463 - 'type' => Controls_Manager::COLOR,
464 - 'separator' => 'before',
465 - 'selectors' => [
466 - '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'color: {{VALUE}};',
467 - ],
468 - ]
469 - );
470 -
471 - $this->add_control(
472 - 'bbpc_color_keywords_bg', [
473 - 'label' => esc_html__( 'Background Color', 'bbp-core' ),
474 - 'type' => Controls_Manager::COLOR,
475 - 'separator' => 'after',
476 - 'selectors' => [
477 - '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'background: {{VALUE}};',
478 - ],
479 - ]
480 - );
481 -
482 - $this->end_controls_tab();
483 -
484 - $this->start_controls_tab(
485 - 'bbpc_keywords_style_hover',
486 - [
487 - 'label' => esc_html__( 'Hover', 'bbp-core' ),
488 - ]
489 - );
490 -
491 - $this->add_control(
492 - 'bbpc_color_keywords_hover', [
493 - 'label' => esc_html__( 'Keyword Color', 'bbp-core' ),
494 - 'type' => Controls_Manager::COLOR,
495 - 'selectors' => [
496 - '{{WRAPPER}} .bbpc-search-keyword ul li a:hover' => 'color: {{VALUE}};',
497 - ],
498 - ]
499 - );
500 -
501 - $this->add_control(
502 - 'bbpc_color_keywords_bg_hover', [
503 - 'label' => esc_html__( 'Background Color', 'bbp-core' ),
504 - 'type' => Controls_Manager::COLOR,
505 - 'selectors' => [
506 - '{{WRAPPER}} .bbpc-search-keyword ul li a:hover' => 'background: {{VALUE}};',
507 - ],
508 - ]
509 - );
510 -
511 - $this->end_controls_tabs();
512 -
513 -
514 - $this->add_group_control(
515 - Group_Control_Typography::get_type(), [
516 - 'name' => 'typography_keywords',
517 - 'label' => esc_html__( 'Typography', 'bbp-core' ),
518 - 'selector' => '{{WRAPPER}} .bbpc-search-keyword ul li a',
519 - ]
520 - );
521 -
522 - $this->add_control(
523 - 'keywords_padding', [
524 - 'label' => __( 'Padding', 'bbp-core' ),
525 - 'type' => Controls_Manager::DIMENSIONS,
526 - 'size_units' => [ 'px', '%', 'em' ],
527 - 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
528 - 'default' => [
529 - 'unit' => 'px',
530 - ],
531 - ]
532 - );
533 -
534 - $this->add_control(
535 - 'border_radius', [
536 - 'label' => __( 'Border Radius', 'bbp-core' ),
537 - 'type' => Controls_Manager::DIMENSIONS,
538 - 'size_units' => [ 'px', '%', 'em' ],
539 - 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
540 - 'default' => [
541 - 'unit' => 'px',
542 - ],
543 - ]
544 - );
545 -
546 - $this->end_controls_section();
547 -
548 - }
549 -
550 - protected function render() {
551 - $settings = $this->get_settings();
552 - $title_tag = ! empty( $settings['title_tag'] ) ? $settings['title_tag'] : 'h2';
553 - $cross_position = $settings['submit_btn_align'] ?? 'right';
554 - if ( $cross_position == 'right' ) {
555 - $cross_position = 'left';
556 - } else {
557 - $cross_position = 'right';
558 - }
559 - ?>
560 -
561 - <div class="bbpc-search-overlay"></div>
562 -
563 - <form action="<?php echo esc_url( home_url( '/' ) ) ?>" role="search" method="get" class="bbpc_search_form_wrapper">
564 - <div class="form-group">
565 - <div class="input-wrapper <?php echo esc_attr( $cross_position ); ?>">
566 -
567 - <span class="submit-btn-<?php echo esc_attr( $settings['submit_btn_align'] ?? 'left' ); ?>">
568 - <button type="submit">
569 - <?php
570 - $submit_btn = $settings['submit_btn_type'] ?? 'icon';
571 - if ( $submit_btn == 'icon' ) {
572 - \Elementor\Icons_Manager::render_icon( $settings['submit_btn_icon'], [ 'aria-hidden' => 'true' ] );
573 - } else {
574 - echo esc_html( $settings['submit_btn_text'] );
575 - }
576 - ?>
577 - </button>
578 - </span>
579 -
580 - <input type='search' id="searchInput" autocomplete="off" name="s" placeholder="<?php echo esc_attr( $settings['placeholder'] ) ?>">
581 -
582 - <!-- Ajax Search Loading Spinner -->
583 - <?php include( 'Search/search-spinner.php' ); ?>
584 -
585 - <!-- WPML Language Code -->
586 - <?php if ( defined( 'ICL_LANGUAGE_CODE' ) ) : ?>
587 - <input type="hidden" name="lang" value="<?php echo( ICL_LANGUAGE_CODE ); ?>"/>
588 - <?php endif; ?>
589 -
590 - <input type="hidden" id="hidden_post_type" name="post_type" value="docs"/>
591 - </div>
592 - </div>
593 - <?php include( 'Search/ajax-sarch-results.php' ); ?>
594 - <?php include( 'Search/keywords.php' ); ?>
595 - </form>
596 - <?php
597 - }
1 +<?php
2 +
3 +namespace admin\Elementor;
4 +
5 +use Elementor\Controls_Manager;
6 +use Elementor\Group_Control_Typography;
7 +use Elementor\Widget_Base;
8 +use Elementor\Group_Control_Border;
9 +
10 +// Exit if accessed directly
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
15 +class Search extends Widget_Base {
16 + public function get_name() {
17 + return 'ama_search';
18 + }
19 +
20 + public function get_title() {
21 + return esc_html__( 'Search (Forumax)', 'forumax' );
22 + }
23 +
24 + public function get_icon() {
25 + return 'bbpc_icon_ama_search eicon-search';
26 + }
27 +
28 + public function get_style_depends() {
29 + return [ 'ama-core-style', 'bbpc-el-widgets' ];
30 + }
31 +
32 + public function get_script_depends() {
33 + return [ 'bbpc-frontend' ];
34 + }
35 +
36 + public function get_categories() {
37 + return [ 'forumax' ];
38 + }
39 +
40 + protected function register_controls() {
41 +
42 + $this->start_controls_section(
43 + 'search_form_sec', [
44 + 'label' => esc_html__( 'Form', 'forumax' ),
45 + ]
46 + );
47 +
48 + $this->add_control(
49 + 'placeholder', [
50 + 'label' => esc_html__( 'Placeholder', 'forumax' ),
51 + 'type' => Controls_Manager::TEXT,
52 + 'label_block' => true,
53 + 'default' => 'Search for Topics....',
54 + ]
55 + );
56 +
57 + $this->add_control(
58 + 'search_post_type', [
59 + 'label' => esc_html__( 'Post Type', 'forumax' ),
60 + 'type' => Controls_Manager::SELECT,
61 + 'default' => 'all',
62 + 'options' => [
63 + 'all' => esc_html__( 'All (Forums, Topics & Replies)', 'forumax' ),
64 + 'forum' => esc_html__( 'Forum', 'forumax' ),
65 + 'topic' => esc_html__( 'Topic', 'forumax' ),
66 + 'reply' => esc_html__( 'Reply', 'forumax' ),
67 + 'post' => esc_html__( 'Post', 'forumax' ),
68 + 'page' => esc_html__( 'Page', 'forumax' ),
69 + 'docs' => esc_html__( 'Docs', 'forumax' ),
70 + ],
71 + ]
72 + );
73 +
74 + $this->add_control(
75 + 'is_ajax_search', [
76 + 'label' => esc_html__( 'AJAX Live Search', 'forumax' ),
77 + 'description' => esc_html__( 'Show search results instantly as users type without page reload.', 'forumax' ),
78 + 'type' => Controls_Manager::SWITCHER,
79 + 'return_value' => 'yes',
80 + 'default' => 'yes',
81 + ]
82 + );
83 +
84 + $this->add_control(
85 + 'search_highlight', [
86 + 'label' => esc_html__( 'Highlight Keywords', 'forumax' ),
87 + 'description' => esc_html__( 'Highlight the matching keyword in search results.', 'forumax' ),
88 + 'type' => Controls_Manager::SWITCHER,
89 + 'return_value' => 'yes',
90 + 'default' => '',
91 + 'condition' => [
92 + 'is_ajax_search' => 'yes',
93 + ],
94 + ]
95 + );
96 +
97 + // select controls
98 + $this->add_control(
99 + 'submit_btn_type', [
100 + 'label' => __( 'Search Type', 'forumax' ),
101 + 'type' => \Elementor\Controls_Manager::SELECT,
102 + 'default' => 'icon',
103 + 'options' => [
104 + 'icon' => __( 'Icon', 'forumax' ),
105 + 'text' => __( 'Text', 'forumax' )
106 + ],
107 + ]
108 + );
109 +
110 + $this->add_control(
111 + 'submit_btn_icon', [
112 + 'label' => __( 'Submit Button Icon', 'forumax' ),
113 + 'type' => \Elementor\Controls_Manager::ICONS,
114 + 'default' => [
115 + 'value' => 'fas fa-search',
116 + 'library' => 'fa-solid',
117 + ],
118 + 'condition' => [
119 + 'submit_btn_type' => 'icon'
120 + ]
121 + ]
122 + );
123 +
124 + $this->add_control(
125 + 'submit_btn_text', [
126 + 'label' => esc_html__( 'Submit Button Text', 'forumax' ),
127 + 'type' => Controls_Manager::TEXT,
128 + 'label_block' => true,
129 + 'default' => __( 'Search', 'forumax' ),
130 + 'condition' => [
131 + 'submit_btn_type' => 'text'
132 + ]
133 + ]
134 + );
135 +
136 + $this->add_control(
137 + 'submit_btn_align', [
138 + 'label' => __( 'Submit Alignment', 'forumax' ),
139 + 'type' => \Elementor\Controls_Manager::CHOOSE,
140 + 'options' => [
141 + 'left' => [
142 + 'title' => __( 'Left', 'forumax' ),
143 + 'icon' => 'fa fa-align-left',
144 + ],
145 + 'right' => [
146 + 'title' => __( 'Right', 'forumax' ),
147 + 'icon' => 'fa fa-align-right',
148 + ],
149 + ],
150 + 'toggle' => false,
151 + 'default' => 'left',
152 + ]
153 + );
154 +
155 + $this->add_control(
156 + 'is_keywords', [
157 + 'label' => esc_html__( 'Keywords', 'forumax' ),
158 + 'type' => \Elementor\Controls_Manager::SWITCHER,
159 + 'return_value' => 'yes',
160 + 'default' => 'yes',
161 + 'separator' => 'before',
162 + ]
163 + );
164 +
165 + $this->add_control(
166 + 'keywords_label',
167 + [
168 + 'label' => esc_html__( 'Keywords Label', 'forumax' ),
169 + 'type' => Controls_Manager::TEXT,
170 + 'label_block' => true,
171 + 'default' => 'Popular:',
172 + 'condition' => [
173 + 'is_keywords' => 'yes'
174 + ]
175 + ]
176 + );
177 +
178 + $this->add_control(
179 + 'keywords_align', [
180 + 'label' => __( 'Keywords Alignment', 'forumax' ),
181 + 'type' => \Elementor\Controls_Manager::CHOOSE,
182 + 'options' => [
183 + 'left' => [
184 + 'title' => __( 'Left', 'forumax' ),
185 + 'icon' => 'fa fa-align-left',
186 + ],
187 + 'center' => [
188 + 'title' => __( 'Center', 'forumax' ),
189 + 'icon' => 'fa fa-align-center',
190 + ],
191 + 'right' => [
192 + 'title' => __( 'Right', 'forumax' ),
193 + 'icon' => 'fa fa-align-right',
194 + ],
195 + ],
196 + 'toggle' => false,
197 + 'default' => 'center'
198 + ]
199 + );
200 +
201 + $keywords = new \Elementor\Repeater();
202 +
203 + $keywords->add_control(
204 + 'title', [
205 + 'label' => __( 'Title', 'forumax' ),
206 + 'type' => \Elementor\Controls_Manager::TEXT,
207 + 'label_block' => true,
208 + ]
209 + );
210 +
211 + $this->add_control(
212 + 'keywords',
213 + [
214 + 'label' => __( 'Repeater List', 'forumax' ),
215 + 'type' => \Elementor\Controls_Manager::REPEATER,
216 + 'fields' => $keywords->get_controls(),
217 + 'default' => [
218 + [
219 + 'title' => __( 'Keyword #1', 'forumax' ),
220 + ],
221 + [
222 + 'title' => __( 'Keyword #2', 'forumax' ),
223 + ],
224 + ],
225 + 'title_field' => '{{{ title }}}',
226 + 'prevent_empty' => false,
227 + 'condition' => [
228 + 'is_keywords' => 'yes'
229 + ]
230 + ]
231 + );
232 +
233 + $this->end_controls_section();
234 +
235 + /**
236 + * Style Keywords
237 + * Global
238 + */
239 + $this->start_controls_section(
240 + 'style_form', [
241 + 'label' => esc_html__( 'Form', 'forumax' ),
242 + 'tab' => Controls_Manager::TAB_STYLE,
243 + ]
244 + );
245 +
246 + $this->add_control(
247 + 'input_heading_form', [
248 + 'label' => esc_html__( 'Input', 'forumax' ),
249 + 'type' => Controls_Manager::HEADING
250 + ]
251 + );
252 +
253 + $this->add_control(
254 + 'color_text', [
255 + 'label' => esc_html__( 'Text Color', 'forumax' ),
256 + 'type' => Controls_Manager::COLOR,
257 + 'selectors' => [
258 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'color: {{VALUE}};',
259 + ]
260 + ]
261 + );
262 +
263 + $this->add_control(
264 + 'color_placeholder', [
265 + 'label' => esc_html__( 'Placeholder Color', 'forumax' ),
266 + 'type' => Controls_Manager::COLOR,
267 + 'selectors' => [
268 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input::placeholder' => 'color: {{VALUE}};',
269 + ],
270 + ]
271 + );
272 +
273 + $this->add_group_control(
274 + Group_Control_Border::get_type(), [
275 + 'name' => 'input_border',
276 + 'label' => esc_html__( 'Border', 'forumax' ),
277 + 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input',
278 + ]
279 + );
280 +
281 + $this->add_control(
282 + 'input_bg_color', [
283 + 'label' => esc_html__( 'Background Color', 'forumax' ),
284 + 'type' => Controls_Manager::COLOR,
285 + 'selectors' => [
286 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'background-color: {{VALUE}};',
287 + ],
288 + ]
289 + );
290 +
291 + $this->add_group_control(
292 + Group_Control_Typography::get_type(), [
293 + 'name' => 'typography_placeholder',
294 + 'label' => esc_html__( 'Typography', 'forumax' ),
295 + 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input::placeholder, .bbpc_search_form_wrapper .input-wrapper input',
296 + ]
297 + );
298 +
299 + $this->add_responsive_control(
300 + 'input-padding', [
301 + 'label' => esc_html__( 'Padding', 'forumax' ),
302 + 'type' => Controls_Manager::DIMENSIONS,
303 + 'size_units' => [ 'px', '%', 'em' ],
304 + 'selectors' => [
305 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
306 + ]
307 + ]
308 + );
309 +
310 + $this->add_responsive_control(
311 + 'input-border-radius', [
312 + 'label' => __( 'Border Radius', 'forumax' ),
313 + 'type' => Controls_Manager::DIMENSIONS,
314 + 'size_units' => [ 'px', '%', 'em' ],
315 + 'selectors' => [
316 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
317 + ],
318 + ]
319 + );
320 +
321 + $this->add_control(
322 + 'submit_heading_form', [
323 + 'label' => esc_html__( 'Submit', 'forumax' ),
324 + 'type' => Controls_Manager::HEADING,
325 + 'separator' => 'before'
326 + ]
327 + );
328 +
329 + $this->add_control(
330 + 'color_icon', [
331 + 'label' => esc_html__( 'Button Color', 'forumax' ),
332 + 'type' => Controls_Manager::COLOR,
333 + 'selectors' => [
334 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'color: {{VALUE}};',
335 + ],
336 + ]
337 + );
338 +
339 +
340 + $this->add_control(
341 + 'search_bg',
342 + [
343 + 'label' => __( 'Background', 'forumax' ),
344 + 'type' => \Elementor\Controls_Manager::COLOR,
345 + 'selectors' => [
346 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'background: {{VALUE}}',
347 + ],
348 + ]
349 + );
350 +
351 + $this->add_responsive_control(
352 + 'btn-padding', [
353 + 'label' => esc_html__( 'Padding', 'forumax' ),
354 + 'type' => Controls_Manager::DIMENSIONS,
355 + 'size_units' => [ 'px', '%', 'em' ],
356 + 'selectors' => [
357 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
358 + ]
359 + ]
360 + );
361 +
362 + $this->add_responsive_control(
363 + 'btn-border-radius', [
364 + 'label' => __( 'Border Radius', 'forumax' ),
365 + 'type' => Controls_Manager::DIMENSIONS,
366 + 'size_units' => [ 'px', '%', 'em' ],
367 + 'selectors' => [
368 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
369 + ],
370 + ]
371 + );
372 +
373 + // slider controls
374 + $this->add_control(
375 + 'typography_btn', [
376 + 'label' => esc_html__( 'Icon Size', 'forumax' ),
377 + 'type' => Controls_Manager::SLIDER,
378 + 'range' => [
379 + 'px' => [
380 + 'min' => 10,
381 + 'max' => 100,
382 + ],
383 + ],
384 + 'selectors' => [
385 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button i' => 'font-size: {{SIZE}}{{UNIT}};'
386 + ],
387 + 'condition' => [
388 + 'submit_btn_type' => 'icon'
389 + ],
390 + ]
391 + );
392 +
393 +
394 + // Spacing slider when icon is on the LEFT.
395 + $this->add_control(
396 + 'submit_btn_align_left', [
397 + 'label' => esc_html__( 'Spacing', 'forumax' ),
398 + 'type' => Controls_Manager::SLIDER,
399 + 'range' => [
400 + 'px' => [
401 + 'min' => 0,
402 + 'max' => 100,
403 + ],
404 + ],
405 + 'selectors' => [
406 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-left' => 'left: {{SIZE}}{{UNIT}};',
407 + ],
408 + 'condition' => [
409 + 'submit_btn_align' => 'left',
410 + ],
411 + ]
412 + );
413 +
414 + // Spacing slider when icon is on the RIGHT.
415 + $this->add_control(
416 + 'submit_btn_align_right', [
417 + 'label' => esc_html__( 'Spacing', 'forumax' ),
418 + 'type' => Controls_Manager::SLIDER,
419 + 'range' => [
420 + 'px' => [
421 + 'min' => 0,
422 + 'max' => 100,
423 + ],
424 + ],
425 + 'selectors' => [
426 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-right' => 'right: {{SIZE}}{{UNIT}};',
427 + ],
428 + 'condition' => [
429 + 'submit_btn_align' => 'right',
430 + ],
431 + ]
432 + );
433 +
434 + // typography controls
435 + $this->add_group_control(
436 + Group_Control_Typography::get_type(), [
437 + 'name' => 'typography_btn',
438 + 'label' => esc_html__( 'Typography', 'forumax' ),
439 + 'condition' => [
440 + 'submit_btn_type' => 'text'
441 + ],
442 + 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button',
443 + ]
444 + );
445 +
446 + $this->end_controls_section();
447 +
448 + $this->start_controls_section(
449 + 'style_keywords', [
450 + 'label' => esc_html__( 'Keywords', 'forumax' ),
451 + 'tab' => Controls_Manager::TAB_STYLE,
452 + ]
453 + );
454 +
455 + $this->add_control(
456 + 'margin_keywords', [
457 + 'label' => __( 'Margin', 'forumax' ),
458 + 'description' => __( 'Margin around the keywords block', 'forumax' ),
459 + 'type' => Controls_Manager::DIMENSIONS,
460 + 'size_units' => [ 'px', '%', 'em' ],
461 + 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
462 + 'separator' => 'before',
463 + 'default' => [
464 + 'unit' => 'px',
465 + ],
466 + ]
467 + );
468 +
469 + $this->add_control(
470 + 'color_keywords_label', [
471 + 'label' => esc_html__( 'Label Color', 'forumax' ),
472 + 'type' => Controls_Manager::COLOR,
473 + 'selectors' => [
474 + '{{WRAPPER}} .bbpc-search-keyword span.bbpc-search-keywords-label' => 'color: {{VALUE}};',
475 + ],
476 + ]
477 + );
478 +
479 + $this->add_group_control(
480 + \Elementor\Group_Control_Typography::get_type(),
481 + [
482 + 'name' => 'keyword_label_typography',
483 + 'label' => __( 'Label Typography', 'forumax' ),
484 + 'selector' => '{{WRAPPER}} .bbpc-search-keyword span.bbpc-search-keywords-label',
485 + ]
486 + );
487 +
488 + $this->start_controls_tabs(
489 + 'bbpc_tabs_keywords_style'
490 + );
491 +
492 + $this->start_controls_tab(
493 + 'bbpc_keywords_style',
494 + [
495 + 'label' => esc_html__( 'Normal', 'forumax' ),
496 + ]
497 + );
498 +
499 + $this->add_control(
500 + 'bbpc_color_keywords', [
501 + 'label' => esc_html__( 'Keyword Color', 'forumax' ),
502 + 'type' => Controls_Manager::COLOR,
503 + 'separator' => 'before',
504 + 'selectors' => [
505 + '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'color: {{VALUE}};',
506 + ],
507 + ]
508 + );
509 +
510 + $this->add_control(
511 + 'bbpc_color_keywords_bg', [
512 + 'label' => esc_html__( 'Background Color', 'forumax' ),
513 + 'type' => Controls_Manager::COLOR,
514 + 'separator' => 'after',
515 + 'selectors' => [
516 + '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'background: {{VALUE}};',
517 + ],
518 + ]
519 + );
520 +
521 + $this->end_controls_tab();
522 +
523 + $this->start_controls_tab(
524 + 'bbpc_keywords_style_hover',
525 + [
526 + 'label' => esc_html__( 'Hover', 'forumax' ),
527 + ]
528 + );
529 +
530 + $this->add_control(
531 + 'bbpc_color_keywords_hover', [
532 + 'label' => esc_html__( 'Keyword Color', 'forumax' ),
533 + 'type' => Controls_Manager::COLOR,
534 + 'selectors' => [
535 + '{{WRAPPER}} .bbpc-search-keyword ul li a:hover' => 'color: {{VALUE}};',
536 + ],
537 + ]
538 + );
539 +
540 + $this->add_control(
541 + 'bbpc_color_keywords_bg_hover', [
542 + 'label' => esc_html__( 'Background Color', 'forumax' ),
543 + 'type' => Controls_Manager::COLOR,
544 + 'selectors' => [
545 + '{{WRAPPER}} .bbpc-search-keyword ul li a:hover' => 'background: {{VALUE}};',
546 + ],
547 + ]
548 + );
549 +
550 + $this->end_controls_tabs();
551 +
552 +
553 + $this->add_group_control(
554 + Group_Control_Typography::get_type(), [
555 + 'name' => 'typography_keywords',
556 + 'label' => esc_html__( 'Typography', 'forumax' ),
557 + 'selector' => '{{WRAPPER}} .bbpc-search-keyword ul li a',
558 + ]
559 + );
560 +
561 + $this->add_control(
562 + 'keywords_padding', [
563 + 'label' => __( 'Padding', 'forumax' ),
564 + 'type' => Controls_Manager::DIMENSIONS,
565 + 'size_units' => [ 'px', '%', 'em' ],
566 + 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
567 + 'default' => [
568 + 'unit' => 'px',
569 + ],
570 + ]
571 + );
572 +
573 + $this->add_control(
574 + 'border_radius', [
575 + 'label' => __( 'Border Radius', 'forumax' ),
576 + 'type' => Controls_Manager::DIMENSIONS,
577 + 'size_units' => [ 'px', '%', 'em' ],
578 + 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
579 + 'default' => [
580 + 'unit' => 'px',
581 + ],
582 + ]
583 + );
584 +
585 + $this->end_controls_section();
586 +
587 + /**
588 + * Style — AJAX Search Results
589 + */
590 + $this->start_controls_section(
591 + 'style_search_results', [
592 + 'label' => esc_html__( 'Search Results', 'forumax' ),
593 + 'tab' => Controls_Manager::TAB_STYLE,
594 + 'condition' => [
595 + 'is_ajax_search' => 'yes',
596 + ],
597 + ]
598 + );
599 +
600 + $this->add_control(
601 + 'results_heading_panel', [
602 + 'label' => esc_html__( 'Panel', 'forumax' ),
603 + 'type' => Controls_Manager::HEADING,
604 + ]
605 + );
606 +
607 + $this->add_control(
608 + 'results_bg_color', [
609 + 'label' => esc_html__( 'Background Color', 'forumax' ),
610 + 'type' => Controls_Manager::COLOR,
611 + 'selectors' => [
612 + '{{WRAPPER}} .bbpc-search-result-container' => 'background-color: {{VALUE}};',
613 + ],
614 + ]
615 + );
616 +
617 + $this->add_group_control(
618 + Group_Control_Border::get_type(), [
619 + 'name' => 'results_border',
620 + 'label' => esc_html__( 'Border', 'forumax' ),
621 + 'selector' => '{{WRAPPER}} .bbpc-search-result-container',
622 + ]
623 + );
624 +
625 + $this->add_responsive_control(
626 + 'results_border_radius', [
627 + 'label' => esc_html__( 'Border Radius', 'forumax' ),
628 + 'type' => Controls_Manager::DIMENSIONS,
629 + 'size_units' => [ 'px', '%', 'em' ],
630 + 'selectors' => [
631 + '{{WRAPPER}} .bbpc-search-result-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
632 + ],
633 + ]
634 + );
635 +
636 + $this->add_control(
637 + 'results_heading_items', [
638 + 'label' => esc_html__( 'Result Items', 'forumax' ),
639 + 'type' => Controls_Manager::HEADING,
640 + 'separator' => 'before',
641 + ]
642 + );
643 +
644 + $this->add_control(
645 + 'results_title_color', [
646 + 'label' => esc_html__( 'Title Color', 'forumax' ),
647 + 'type' => Controls_Manager::COLOR,
648 + 'selectors' => [
649 + '{{WRAPPER}} .bbpc-search-result-container .bbpc-result-title' => 'color: {{VALUE}};',
650 + ],
651 + ]
652 + );
653 +
654 + $this->add_control(
655 + 'results_meta_color', [
656 + 'label' => esc_html__( 'Meta Color', 'forumax' ),
657 + 'type' => Controls_Manager::COLOR,
658 + 'selectors' => [
659 + '{{WRAPPER}} .bbpc-search-result-container .bbpc-result-type' => 'color: {{VALUE}};',
660 + '{{WRAPPER}} .bbpc-search-result-container .bbpc-breadcrumb-item' => 'color: {{VALUE}};',
661 + '{{WRAPPER}} .bbpc-search-result-container .bbpc-result-icon' => 'color: {{VALUE}};',
662 + ],
663 + ]
664 + );
665 +
666 + $this->add_control(
667 + 'results_hover_bg', [
668 + 'label' => esc_html__( 'Hover Background', 'forumax' ),
669 + 'type' => Controls_Manager::COLOR,
670 + 'selectors' => [
671 + '{{WRAPPER}} .bbpc-search-result-container .search-result-item:hover' => 'background-color: {{VALUE}};',
672 + ],
673 + ]
674 + );
675 +
676 + $this->add_control(
677 + 'results_heading_empty', [
678 + 'label' => esc_html__( 'Empty State', 'forumax' ),
679 + 'type' => Controls_Manager::HEADING,
680 + 'separator' => 'before',
681 + ]
682 + );
683 +
684 + $this->add_control(
685 + 'results_empty_title_color', [
686 + 'label' => esc_html__( 'Title Color', 'forumax' ),
687 + 'type' => Controls_Manager::COLOR,
688 + 'selectors' => [
689 + '{{WRAPPER}} .bbpc-search-result-container .bbpc-not-found-text' => 'color: {{VALUE}};',
690 + ],
691 + ]
692 + );
693 +
694 + $this->add_control(
695 + 'results_empty_hint_color', [
696 + 'label' => esc_html__( 'Hint Color', 'forumax' ),
697 + 'type' => Controls_Manager::COLOR,
698 + 'selectors' => [
699 + '{{WRAPPER}} .bbpc-search-result-container .bbpc-search-empty-hint' => 'color: {{VALUE}};',
700 + ],
701 + ]
702 + );
703 +
704 + $this->end_controls_section();
705 +
706 + }
707 +
708 + protected function render() {
709 + $settings = $this->get_settings();
710 + $widget_id = 'frmx-search-' . $this->get_id();
711 + $input_id = $widget_id . '-input';
712 + $result_id = $widget_id . '-result';
713 + $post_type_id = $widget_id . '-post-type';
714 +
715 + /*
716 + * $btn_position holds the raw saved value: 'left' or 'right'.
717 + * It is used directly — no inversion needed — so the span class
718 + * and the input-wrapper class both reflect the actual chosen side.
719 + */
720 + $btn_position = $settings['submit_btn_align'] ?? 'left';
721 +
722 + $search_post_type = ! empty( $settings['search_post_type'] ) ? $settings['search_post_type'] : 'all';
723 + $is_ajax_search = ! empty( $settings['is_ajax_search'] ) ? 'true' : 'false';
724 + $search_highlight = ! empty( $settings['search_highlight'] ) ? 'true' : 'false';
725 + ?>
726 +
727 + <div class="bbpc-search-overlay" data-widget-id="<?php echo esc_attr( $widget_id ); ?>"></div>
728 +
729 + <form
730 + action="<?php echo esc_url( bbp_get_search_url() ); ?>"
731 + role="search"
732 + method="get"
733 + class="bbpc_search_form_wrapper"
734 + data-widget-id="<?php echo esc_attr( $widget_id ); ?>"
735 + data-input-id="<?php echo esc_attr( $input_id ); ?>"
736 + data-result-id="<?php echo esc_attr( $result_id ); ?>"
737 + >
738 + <div class="form-group">
739 + <div class="input-wrapper <?php echo esc_attr( $btn_position ); ?>">
740 +
741 + <span class="submit-btn-<?php echo esc_attr( $btn_position ); ?>">
742 + <button type="submit">
743 + <?php
744 + $submit_btn = $settings['submit_btn_type'] ?? 'icon';
745 + if ( 'icon' === $submit_btn ) {
746 + \Elementor\Icons_Manager::render_icon( $settings['submit_btn_icon'], [ 'aria-hidden' => 'true' ] );
747 + } else {
748 + echo esc_html( $settings['submit_btn_text'] );
749 + }
750 + ?>
751 + </button>
752 + </span>
753 +
754 + <!-- bbPress search request sentinel -->
755 + <input type="hidden" name="action" value="bbp-search-request" />
756 +
757 + <input
758 + type="search"
759 + id="<?php echo esc_attr( $input_id ); ?>"
760 + class="frmx-search-input"
761 + autocomplete="off"
762 + name="bbp_search"
763 + placeholder="<?php echo esc_attr( $settings['placeholder'] ); ?>"
764 + data-post-type="<?php echo esc_attr( $search_post_type ); ?>"
765 + data-ajax-search="<?php echo esc_attr( $is_ajax_search ); ?>"
766 + data-highlight="<?php echo esc_attr( $search_highlight ); ?>"
767 + data-result-id="<?php echo esc_attr( $result_id ); ?>"
768 + >
769 +
770 + <!-- Ajax Search Loading Spinner -->
771 + <?php include( 'Search/search-spinner.php' ); ?>
772 +
773 + <!-- WPML Language Code -->
774 + <?php if ( defined( 'ICL_LANGUAGE_CODE' ) ) : ?>
775 + <input type="hidden" name="lang" value="<?php echo esc_attr( ICL_LANGUAGE_CODE ); ?>"/>
776 + <?php endif; ?>
777 + </div>
778 + </div>
779 + <?php
780 + // Pass unique result ID to the partials via a local variable.
781 + $frmx_result_id = $result_id;
782 + include 'Search/ajax-sarch-results.php';
783 + include 'Search/keywords.php';
784 + ?>
785 + </form>
786 + <?php
787 + }
598 788 }