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 +291 -101 1.4.1 → 2.5.0 View file →
@@ -15,15 +15,15 @@
15 15 class Search extends Widget_Base {
16 16 public function get_name() {
17 17 return 'ama_search';
18 18 }
19 -
19 +
20 20 public function get_title() {
21 - return esc_html__( 'BBPC Search', 'bbp-core' );
21 + return esc_html__( 'Search (Forumax)', 'forumax' );
22 22 }
23 23
24 24 public function get_icon() {
25 - return 'bbpc_icon_ama_search';
25 + return 'bbpc_icon_ama_search eicon-search';
26 26 }
27 27
28 28 public function get_style_depends() {
29 29 return [ 'ama-core-style', 'bbpc-el-widgets' ];
@@ -29,13 +29,13 @@
29 29 return [ 'ama-core-style', 'bbpc-el-widgets' ];
30 30 }
31 31
32 32 public function get_script_depends() {
33 - return [ 'bbpc-frontend-js', 'bbpc-frontend-js' ];
33 + return [ 'bbpc-frontend' ];
34 34 }
35 35
36 36 public function get_categories() {
37 - return [ 'bbp-core' ];
37 + return [ 'forumax' ];
38 38 }
39 39
40 40 protected function register_controls() {
41 41
@@ -40,15 +40,15 @@
40 40 protected function register_controls() {
41 41
42 42 $this->start_controls_section(
43 43 'search_form_sec', [
44 - 'label' => esc_html__( 'Form', 'bbp-core' ),
44 + 'label' => esc_html__( 'Form', 'forumax' ),
45 45 ]
46 46 );
47 47
48 48 $this->add_control(
49 49 'placeholder', [
50 - 'label' => esc_html__( 'Placeholder', 'bbp-core' ),
50 + 'label' => esc_html__( 'Placeholder', 'forumax' ),
51 51 'type' => Controls_Manager::TEXT,
52 52 'label_block' => true,
53 53 'default' => 'Search for Topics....',
54 54 ]
@@ -53,17 +53,57 @@
53 53 'default' => 'Search for Topics....',
54 54 ]
55 55 );
56 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 +
57 97 // select controls
58 98 $this->add_control(
59 99 'submit_btn_type', [
60 - 'label' => __( 'Search Type', 'bbp-core' ),
100 + 'label' => __( 'Search Type', 'forumax' ),
61 101 'type' => \Elementor\Controls_Manager::SELECT,
62 102 'default' => 'icon',
63 103 'options' => [
64 - 'icon' => __( 'Icon', 'bbp-core' ),
65 - 'text' => __( 'Text', 'bbp-core' )
104 + 'icon' => __( 'Icon', 'forumax' ),
105 + 'text' => __( 'Text', 'forumax' )
66 106 ],
67 107 ]
68 108 );
69 109
@@ -68,13 +108,13 @@
68 108 );
69 109
70 110 $this->add_control(
71 111 'submit_btn_icon', [
72 - 'label' => __( 'Submit Button Icon', 'bbp-core' ),
112 + 'label' => __( 'Submit Button Icon', 'forumax' ),
73 113 'type' => \Elementor\Controls_Manager::ICONS,
74 114 'default' => [
75 115 'value' => 'fas fa-search',
76 - 'library' => 'solid',
116 + 'library' => 'fa-solid',
77 117 ],
78 118 'condition' => [
79 119 'submit_btn_type' => 'icon'
80 120 ]
@@ -82,12 +122,12 @@
82 122 );
83 123
84 124 $this->add_control(
85 125 'submit_btn_text', [
86 - 'label' => esc_html__( 'Submit Button Text', 'bbp-core' ),
126 + 'label' => esc_html__( 'Submit Button Text', 'forumax' ),
87 127 'type' => Controls_Manager::TEXT,
88 128 'label_block' => true,
89 - 'default' => __( 'Search', 'bbp-core' ),
129 + 'default' => __( 'Search', 'forumax' ),
90 130 'condition' => [
91 131 'submit_btn_type' => 'text'
92 132 ]
93 133 ]
@@ -94,28 +134,28 @@
94 134 );
95 135
96 136 $this->add_control(
97 137 'submit_btn_align', [
98 - 'label' => __( 'Submit Alignment', 'bbp-core' ),
138 + 'label' => __( 'Submit Alignment', 'forumax' ),
99 139 'type' => \Elementor\Controls_Manager::CHOOSE,
100 140 'options' => [
101 - 'right' => [
102 - 'title' => __( 'Left', 'bbp-core' ),
141 + 'left' => [
142 + 'title' => __( 'Left', 'forumax' ),
103 143 'icon' => 'fa fa-align-left',
104 144 ],
105 - 'left' => [
106 - 'title' => __( 'Right', 'bbp-core' ),
145 + 'right' => [
146 + 'title' => __( 'Right', 'forumax' ),
107 147 'icon' => 'fa fa-align-right',
108 148 ],
109 149 ],
110 150 'toggle' => false,
111 - 'default' => 'left'
151 + 'default' => 'left',
112 152 ]
113 153 );
114 154
115 155 $this->add_control(
116 156 'is_keywords', [
117 - 'label' => esc_html__( 'Keywords', 'bbp-core' ),
157 + 'label' => esc_html__( 'Keywords', 'forumax' ),
118 158 'type' => \Elementor\Controls_Manager::SWITCHER,
119 159 'return_value' => 'yes',
120 160 'default' => 'yes',
121 161 'separator' => 'before',
@@ -124,9 +164,9 @@
124 164
125 165 $this->add_control(
126 166 'keywords_label',
127 167 [
128 - 'label' => esc_html__( 'Keywords Label', 'bbp-core' ),
168 + 'label' => esc_html__( 'Keywords Label', 'forumax' ),
129 169 'type' => Controls_Manager::TEXT,
130 170 'label_block' => true,
131 171 'default' => 'Popular:',
132 172 'condition' => [
@@ -136,21 +176,21 @@
136 176 );
137 177
138 178 $this->add_control(
139 179 'keywords_align', [
140 - 'label' => __( 'Keywords Alignment', 'bbp-core' ),
180 + 'label' => __( 'Keywords Alignment', 'forumax' ),
141 181 'type' => \Elementor\Controls_Manager::CHOOSE,
142 182 'options' => [
143 183 'left' => [
144 - 'title' => __( 'Left', 'bbp-core' ),
184 + 'title' => __( 'Left', 'forumax' ),
145 185 'icon' => 'fa fa-align-left',
146 186 ],
147 187 'center' => [
148 - 'title' => __( 'Center', 'bbp-core' ),
188 + 'title' => __( 'Center', 'forumax' ),
149 189 'icon' => 'fa fa-align-center',
150 190 ],
151 191 'right' => [
152 - 'title' => __( 'Right', 'bbp-core' ),
192 + 'title' => __( 'Right', 'forumax' ),
153 193 'icon' => 'fa fa-align-right',
154 194 ],
155 195 ],
156 196 'toggle' => false,
@@ -161,9 +201,9 @@
161 201 $keywords = new \Elementor\Repeater();
162 202
163 203 $keywords->add_control(
164 204 'title', [
165 - 'label' => __( 'Title', 'bbp-core' ),
205 + 'label' => __( 'Title', 'forumax' ),
166 206 'type' => \Elementor\Controls_Manager::TEXT,
167 207 'label_block' => true,
168 208 ]
169 209 );
@@ -170,17 +210,17 @@
170 210
171 211 $this->add_control(
172 212 'keywords',
173 213 [
174 - 'label' => __( 'Repeater List', 'bbp-core' ),
214 + 'label' => __( 'Repeater List', 'forumax' ),
175 215 'type' => \Elementor\Controls_Manager::REPEATER,
176 216 'fields' => $keywords->get_controls(),
177 217 'default' => [
178 218 [
179 - 'title' => __( 'Keyword #1', 'bbp-core' ),
219 + 'title' => __( 'Keyword #1', 'forumax' ),
180 220 ],
181 221 [
182 - 'title' => __( 'Keyword #2', 'bbp-core' ),
222 + 'title' => __( 'Keyword #2', 'forumax' ),
183 223 ],
184 224 ],
185 225 'title_field' => '{{{ title }}}',
186 226 'prevent_empty' => false,
@@ -197,9 +237,9 @@
197 237 * Global
198 238 */
199 239 $this->start_controls_section(
200 240 'style_form', [
201 - 'label' => esc_html__( 'Form', 'bbp-core' ),
241 + 'label' => esc_html__( 'Form', 'forumax' ),
202 242 'tab' => Controls_Manager::TAB_STYLE,
203 243 ]
204 244 );
205 245
@@ -204,9 +244,9 @@
204 244 );
205 245
206 246 $this->add_control(
207 247 'input_heading_form', [
208 - 'label' => esc_html__( 'Input', 'bbp-core' ),
248 + 'label' => esc_html__( 'Input', 'forumax' ),
209 249 'type' => Controls_Manager::HEADING
210 250 ]
211 251 );
212 252
@@ -211,9 +251,9 @@
211 251 );
212 252
213 253 $this->add_control(
214 254 'color_text', [
215 - 'label' => esc_html__( 'Text Color', 'bbp-core' ),
255 + 'label' => esc_html__( 'Text Color', 'forumax' ),
216 256 'type' => Controls_Manager::COLOR,
217 257 'selectors' => [
218 258 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'color: {{VALUE}};',
219 259 ]
@@ -221,9 +261,9 @@
221 261 );
222 262
223 263 $this->add_control(
224 264 'color_placeholder', [
225 - 'label' => esc_html__( 'Placeholder Color', 'bbp-core' ),
265 + 'label' => esc_html__( 'Placeholder Color', 'forumax' ),
226 266 'type' => Controls_Manager::COLOR,
227 267 'selectors' => [
228 268 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input::placeholder' => 'color: {{VALUE}};',
229 269 ],
@@ -232,9 +272,9 @@
232 272
233 273 $this->add_group_control(
234 274 Group_Control_Border::get_type(), [
235 275 'name' => 'input_border',
236 - 'label' => esc_html__( 'Border', 'bbp-core' ),
276 + 'label' => esc_html__( 'Border', 'forumax' ),
237 277 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input',
238 278 ]
239 279 );
240 280
@@ -239,9 +279,9 @@
239 279 );
240 280
241 281 $this->add_control(
242 282 'input_bg_color', [
243 - 'label' => esc_html__( 'Background Color', 'bbp-core' ),
283 + 'label' => esc_html__( 'Background Color', 'forumax' ),
244 284 'type' => Controls_Manager::COLOR,
245 285 'selectors' => [
246 286 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'background-color: {{VALUE}};',
247 287 ],
@@ -250,9 +290,9 @@
250 290
251 291 $this->add_group_control(
252 292 Group_Control_Typography::get_type(), [
253 293 'name' => 'typography_placeholder',
254 - 'label' => esc_html__( 'Typography', 'bbp-core' ),
294 + 'label' => esc_html__( 'Typography', 'forumax' ),
255 295 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input::placeholder, .bbpc_search_form_wrapper .input-wrapper input',
256 296 ]
257 297 );
258 298
@@ -257,9 +297,9 @@
257 297 );
258 298
259 299 $this->add_responsive_control(
260 300 'input-padding', [
261 - 'label' => esc_html__( 'Padding', 'bbp-core' ),
301 + 'label' => esc_html__( 'Padding', 'forumax' ),
262 302 'type' => Controls_Manager::DIMENSIONS,
263 303 'size_units' => [ 'px', '%', 'em' ],
264 304 'selectors' => [
265 305 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
@@ -268,9 +308,9 @@
268 308 );
269 309
270 310 $this->add_responsive_control(
271 311 'input-border-radius', [
272 - 'label' => __( 'Border Radius', 'bbp-core' ),
312 + 'label' => __( 'Border Radius', 'forumax' ),
273 313 'type' => Controls_Manager::DIMENSIONS,
274 314 'size_units' => [ 'px', '%', 'em' ],
275 315 'selectors' => [
276 316 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -279,9 +319,9 @@
279 319 );
280 320
281 321 $this->add_control(
282 322 'submit_heading_form', [
283 - 'label' => esc_html__( 'Submit', 'bbp-core' ),
323 + 'label' => esc_html__( 'Submit', 'forumax' ),
284 324 'type' => Controls_Manager::HEADING,
285 325 'separator' => 'before'
286 326 ]
287 327 );
@@ -287,9 +327,9 @@
287 327 );
288 328
289 329 $this->add_control(
290 330 'color_icon', [
291 - 'label' => esc_html__( 'Button Color', 'bbp-core' ),
331 + 'label' => esc_html__( 'Button Color', 'forumax' ),
292 332 'type' => Controls_Manager::COLOR,
293 333 'selectors' => [
294 334 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'color: {{VALUE}};',
295 335 ],
@@ -299,9 +339,9 @@
299 339
300 340 $this->add_control(
301 341 'search_bg',
302 342 [
303 - 'label' => __( 'Background', 'bbp-core' ),
343 + 'label' => __( 'Background', 'forumax' ),
304 344 'type' => \Elementor\Controls_Manager::COLOR,
305 345 'selectors' => [
306 346 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'background: {{VALUE}}',
307 347 ],
@@ -309,9 +349,9 @@
309 349 );
310 350
311 351 $this->add_responsive_control(
312 352 'btn-padding', [
313 - 'label' => esc_html__( 'Padding', 'bbp-core' ),
353 + 'label' => esc_html__( 'Padding', 'forumax' ),
314 354 'type' => Controls_Manager::DIMENSIONS,
315 355 'size_units' => [ 'px', '%', 'em' ],
316 356 'selectors' => [
317 357 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
@@ -320,9 +360,9 @@
320 360 );
321 361
322 362 $this->add_responsive_control(
323 363 'btn-border-radius', [
324 - 'label' => __( 'Border Radius', 'bbp-core' ),
364 + 'label' => __( 'Border Radius', 'forumax' ),
325 365 'type' => Controls_Manager::DIMENSIONS,
326 366 'size_units' => [ 'px', '%', 'em' ],
327 367 'selectors' => [
328 368 '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -332,9 +372,9 @@
332 372
333 373 // slider controls
334 374 $this->add_control(
335 375 'typography_btn', [
336 - 'label' => esc_html__( 'Icon Size', 'bbp-core' ),
376 + 'label' => esc_html__( 'Icon Size', 'forumax' ),
337 377 'type' => Controls_Manager::SLIDER,
338 378 'range' => [
339 379 'px' => [
340 380 'min' => 10,
@@ -350,45 +390,44 @@
350 390 ]
351 391 );
352 392
353 393
354 - // slider controls
394 + // Spacing slider when icon is on the LEFT.
355 395 $this->add_control(
356 396 'submit_btn_align_left', [
357 - 'label' => esc_html__( 'Spacing', 'bbp-core' ),
397 + 'label' => esc_html__( 'Spacing', 'forumax' ),
358 398 'type' => Controls_Manager::SLIDER,
359 399 'range' => [
360 400 'px' => [
361 - 'min' => 10,
401 + 'min' => 0,
362 402 'max' => 100,
363 403 ],
364 404 ],
365 405 'selectors' => [
366 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-left' => 'right: {{SIZE}}{{UNIT}};',
406 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-left' => 'left: {{SIZE}}{{UNIT}};',
367 407 ],
368 408 'condition' => [
369 - 'submit_btn_align' => 'left'
409 + 'submit_btn_align' => 'left',
370 410 ],
371 411 ]
372 412 );
373 413
374 -
375 - // slider controls
414 + // Spacing slider when icon is on the RIGHT.
376 415 $this->add_control(
377 416 'submit_btn_align_right', [
378 - 'label' => esc_html__( 'Spacing', 'bbp-core' ),
417 + 'label' => esc_html__( 'Spacing', 'forumax' ),
379 418 'type' => Controls_Manager::SLIDER,
380 419 'range' => [
381 420 'px' => [
382 - 'min' => 10,
421 + 'min' => 0,
383 422 'max' => 100,
384 423 ],
385 424 ],
386 425 'selectors' => [
387 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-right' => 'left: {{SIZE}}{{UNIT}};',
426 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-right' => 'right: {{SIZE}}{{UNIT}};',
388 427 ],
389 428 'condition' => [
390 - 'submit_btn_align' => 'right'
429 + 'submit_btn_align' => 'right',
391 430 ],
392 431 ]
393 432 );
394 433
@@ -395,9 +434,9 @@
395 434 // typography controls
396 435 $this->add_group_control(
397 436 Group_Control_Typography::get_type(), [
398 437 'name' => 'typography_btn',
399 - 'label' => esc_html__( 'Typography', 'bbp-core' ),
438 + 'label' => esc_html__( 'Typography', 'forumax' ),
400 439 'condition' => [
401 440 'submit_btn_type' => 'text'
402 441 ],
403 442 'selector' => '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper button',
@@ -407,9 +446,9 @@
407 446 $this->end_controls_section();
408 447
409 448 $this->start_controls_section(
410 449 'style_keywords', [
411 - 'label' => esc_html__( 'Keywords', 'bbp-core' ),
450 + 'label' => esc_html__( 'Keywords', 'forumax' ),
412 451 'tab' => Controls_Manager::TAB_STYLE,
413 452 ]
414 453 );
415 454
@@ -414,10 +453,10 @@
414 453 );
415 454
416 455 $this->add_control(
417 456 'margin_keywords', [
418 - 'label' => __( 'Margin', 'bbp-core' ),
419 - 'description' => __( 'Margin around the keywords block', 'bbp-core' ),
457 + 'label' => __( 'Margin', 'forumax' ),
458 + 'description' => __( 'Margin around the keywords block', 'forumax' ),
420 459 'type' => Controls_Manager::DIMENSIONS,
421 460 'size_units' => [ 'px', '%', 'em' ],
422 461 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
423 462 'separator' => 'before',
@@ -428,9 +467,9 @@
428 467 );
429 468
430 469 $this->add_control(
431 470 'color_keywords_label', [
432 - 'label' => esc_html__( 'Label Color', 'bbp-core' ),
471 + 'label' => esc_html__( 'Label Color', 'forumax' ),
433 472 'type' => Controls_Manager::COLOR,
434 473 'selectors' => [
435 474 '{{WRAPPER}} .bbpc-search-keyword span.bbpc-search-keywords-label' => 'color: {{VALUE}};',
436 475 ],
@@ -440,9 +479,9 @@
440 479 $this->add_group_control(
441 480 \Elementor\Group_Control_Typography::get_type(),
442 481 [
443 482 'name' => 'keyword_label_typography',
444 - 'label' => __( 'Label Typography', 'bbp-core' ),
483 + 'label' => __( 'Label Typography', 'forumax' ),
445 484 'selector' => '{{WRAPPER}} .bbpc-search-keyword span.bbpc-search-keywords-label',
446 485 ]
447 486 );
448 487
@@ -452,15 +491,15 @@
452 491
453 492 $this->start_controls_tab(
454 493 'bbpc_keywords_style',
455 494 [
456 - 'label' => esc_html__( 'Normal', 'bbp-core' ),
495 + 'label' => esc_html__( 'Normal', 'forumax' ),
457 496 ]
458 497 );
459 498
460 499 $this->add_control(
461 500 'bbpc_color_keywords', [
462 - 'label' => esc_html__( 'Keyword Color', 'bbp-core' ),
501 + 'label' => esc_html__( 'Keyword Color', 'forumax' ),
463 502 'type' => Controls_Manager::COLOR,
464 503 'separator' => 'before',
465 504 'selectors' => [
466 505 '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'color: {{VALUE}};',
@@ -469,9 +508,9 @@
469 508 );
470 509
471 510 $this->add_control(
472 511 'bbpc_color_keywords_bg', [
473 - 'label' => esc_html__( 'Background Color', 'bbp-core' ),
512 + 'label' => esc_html__( 'Background Color', 'forumax' ),
474 513 'type' => Controls_Manager::COLOR,
475 514 'separator' => 'after',
476 515 'selectors' => [
477 516 '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'background: {{VALUE}};',
@@ -483,15 +522,15 @@
483 522
484 523 $this->start_controls_tab(
485 524 'bbpc_keywords_style_hover',
486 525 [
487 - 'label' => esc_html__( 'Hover', 'bbp-core' ),
526 + 'label' => esc_html__( 'Hover', 'forumax' ),
488 527 ]
489 528 );
490 529
491 530 $this->add_control(
492 531 'bbpc_color_keywords_hover', [
493 - 'label' => esc_html__( 'Keyword Color', 'bbp-core' ),
532 + 'label' => esc_html__( 'Keyword Color', 'forumax' ),
494 533 'type' => Controls_Manager::COLOR,
495 534 'selectors' => [
496 535 '{{WRAPPER}} .bbpc-search-keyword ul li a:hover' => 'color: {{VALUE}};',
497 536 ],
@@ -499,9 +538,9 @@
499 538 );
500 539
501 540 $this->add_control(
502 541 'bbpc_color_keywords_bg_hover', [
503 - 'label' => esc_html__( 'Background Color', 'bbp-core' ),
542 + 'label' => esc_html__( 'Background Color', 'forumax' ),
504 543 'type' => Controls_Manager::COLOR,
505 544 'selectors' => [
506 545 '{{WRAPPER}} .bbpc-search-keyword ul li a:hover' => 'background: {{VALUE}};',
507 546 ],
@@ -513,9 +552,9 @@
513 552
514 553 $this->add_group_control(
515 554 Group_Control_Typography::get_type(), [
516 555 'name' => 'typography_keywords',
517 - 'label' => esc_html__( 'Typography', 'bbp-core' ),
556 + 'label' => esc_html__( 'Typography', 'forumax' ),
518 557 'selector' => '{{WRAPPER}} .bbpc-search-keyword ul li a',
519 558 ]
520 559 );
521 560
@@ -520,9 +559,9 @@
520 559 );
521 560
522 561 $this->add_control(
523 562 'keywords_padding', [
524 - 'label' => __( 'Padding', 'bbp-core' ),
563 + 'label' => __( 'Padding', 'forumax' ),
525 564 'type' => Controls_Manager::DIMENSIONS,
526 565 'size_units' => [ 'px', '%', 'em' ],
527 566 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
528 567 'default' => [
@@ -532,9 +571,9 @@
532 571 );
533 572
534 573 $this->add_control(
535 574 'border_radius', [
536 - 'label' => __( 'Border Radius', 'bbp-core' ),
575 + 'label' => __( 'Border Radius', 'forumax' ),
537 576 'type' => Controls_Manager::DIMENSIONS,
538 577 'size_units' => [ 'px', '%', 'em' ],
539 578 'selectors' => [ '{{WRAPPER}} .bbpc-search-keyword ul li a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ],
540 579 'default' => [
@@ -544,55 +583,206 @@
544 583 );
545 584
546 585 $this->end_controls_section();
547 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 +
548 706 }
549 707
550 708 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 - }
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';
559 725 ?>
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">
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">
569 743 <?php
570 744 $submit_btn = $settings['submit_btn_type'] ?? 'icon';
571 - if ( $submit_btn == 'icon' ) {
745 + if ( 'icon' === $submit_btn ) {
572 746 \Elementor\Icons_Manager::render_icon( $settings['submit_btn_icon'], [ 'aria-hidden' => 'true' ] );
573 747 } else {
574 748 echo esc_html( $settings['submit_btn_text'] );
575 749 }
576 750 ?>
577 - </button>
751 + </button>
578 752 </span>
579 753
580 - <input type='search' id="searchInput" autocomplete="off" name="s" placeholder="<?php echo esc_attr( $settings['placeholder'] ) ?>">
754 + <!-- bbPress search request sentinel -->
755 + <input type="hidden" name="action" value="bbp-search-request" />
581 756
582 - <!-- Ajax Search Loading Spinner -->
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 -->
583 771 <?php include( 'Search/search-spinner.php' ); ?>
584 772
585 - <!-- WPML Language Code -->
773 + <!-- WPML Language Code -->
586 774 <?php if ( defined( 'ICL_LANGUAGE_CODE' ) ) : ?>
587 - <input type="hidden" name="lang" value="<?php echo esc_attr( ICL_LANGUAGE_CODE ); ?>"/>
775 + <input type="hidden" name="lang" value="<?php echo esc_attr( ICL_LANGUAGE_CODE ); ?>"/>
588 776 <?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>
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>
596 786 <?php
597 787 }
598 788 }