| 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__( 'Forumax Search', 'forumax' ); |
| 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 [ '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 |
// select controls |
| 58 |
$this->add_control( |
| 59 |
'submit_btn_type', [ |
| 60 |
'label' => __( 'Search Type', 'forumax' ), |
| 61 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 62 |
'default' => 'icon', |
| 63 |
'options' => [ |
| 64 |
'icon' => __( 'Icon', 'forumax' ), |
| 65 |
'text' => __( 'Text', 'forumax' ) |
| 66 |
], |
| 67 |
] |
| 68 |
); |
| 69 |
|
| 70 |
$this->add_control( |
| 71 |
'submit_btn_icon', [ |
| 72 |
'label' => __( 'Submit Button Icon', 'forumax' ), |
| 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', 'forumax' ), |
| 87 |
'type' => Controls_Manager::TEXT, |
| 88 |
'label_block' => true, |
| 89 |
'default' => __( 'Search', 'forumax' ), |
| 90 |
'condition' => [ |
| 91 |
'submit_btn_type' => 'text' |
| 92 |
] |
| 93 |
] |
| 94 |
); |
| 95 |
|
| 96 |
$this->add_control( |
| 97 |
'submit_btn_align', [ |
| 98 |
'label' => __( 'Submit Alignment', 'forumax' ), |
| 99 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 100 |
'options' => [ |
| 101 |
'right' => [ |
| 102 |
'title' => __( 'Left', 'forumax' ), |
| 103 |
'icon' => 'fa fa-align-left', |
| 104 |
], |
| 105 |
'left' => [ |
| 106 |
'title' => __( 'Right', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 141 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 142 |
'options' => [ |
| 143 |
'left' => [ |
| 144 |
'title' => __( 'Left', 'forumax' ), |
| 145 |
'icon' => 'fa fa-align-left', |
| 146 |
], |
| 147 |
'center' => [ |
| 148 |
'title' => __( 'Center', 'forumax' ), |
| 149 |
'icon' => 'fa fa-align-center', |
| 150 |
], |
| 151 |
'right' => [ |
| 152 |
'title' => __( 'Right', 'forumax' ), |
| 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', 'forumax' ), |
| 166 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 167 |
'label_block' => true, |
| 168 |
] |
| 169 |
); |
| 170 |
|
| 171 |
$this->add_control( |
| 172 |
'keywords', |
| 173 |
[ |
| 174 |
'label' => __( 'Repeater List', 'forumax' ), |
| 175 |
'type' => \Elementor\Controls_Manager::REPEATER, |
| 176 |
'fields' => $keywords->get_controls(), |
| 177 |
'default' => [ |
| 178 |
[ |
| 179 |
'title' => __( 'Keyword #1', 'forumax' ), |
| 180 |
], |
| 181 |
[ |
| 182 |
'title' => __( 'Keyword #2', 'forumax' ), |
| 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', 'forumax' ), |
| 202 |
'tab' => Controls_Manager::TAB_STYLE, |
| 203 |
] |
| 204 |
); |
| 205 |
|
| 206 |
$this->add_control( |
| 207 |
'input_heading_form', [ |
| 208 |
'label' => esc_html__( 'Input', 'forumax' ), |
| 209 |
'type' => Controls_Manager::HEADING |
| 210 |
] |
| 211 |
); |
| 212 |
|
| 213 |
$this->add_control( |
| 214 |
'color_text', [ |
| 215 |
'label' => esc_html__( 'Text Color', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 284 |
'type' => Controls_Manager::HEADING, |
| 285 |
'separator' => 'before' |
| 286 |
] |
| 287 |
); |
| 288 |
|
| 289 |
$this->add_control( |
| 290 |
'color_icon', [ |
| 291 |
'label' => esc_html__( 'Button Color', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 412 |
'tab' => Controls_Manager::TAB_STYLE, |
| 413 |
] |
| 414 |
); |
| 415 |
|
| 416 |
$this->add_control( |
| 417 |
'margin_keywords', [ |
| 418 |
'label' => __( 'Margin', 'forumax' ), |
| 419 |
'description' => __( 'Margin around the keywords block', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 457 |
] |
| 458 |
); |
| 459 |
|
| 460 |
$this->add_control( |
| 461 |
'bbpc_color_keywords', [ |
| 462 |
'label' => esc_html__( 'Keyword Color', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 488 |
] |
| 489 |
); |
| 490 |
|
| 491 |
$this->add_control( |
| 492 |
'bbpc_color_keywords_hover', [ |
| 493 |
'label' => esc_html__( 'Keyword Color', 'forumax' ), |
| 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', 'forumax' ), |
| 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', 'forumax' ), |
| 518 |
'selector' => '{{WRAPPER}} .bbpc-search-keyword ul li a', |
| 519 |
] |
| 520 |
); |
| 521 |
|
| 522 |
$this->add_control( |
| 523 |
'keywords_padding', [ |
| 524 |
'label' => __( 'Padding', 'forumax' ), |
| 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', 'forumax' ), |
| 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 esc_attr( 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 |
} |
| 598 |
} |