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