| 1 |
<?php |
| 2 |
namespace Easyel\EasyElements\Widgets; |
| 3 |
use Elementor\Controls_Manager; |
| 4 |
use Elementor\Widget_Base; |
| 5 |
use Elementor\Group_Control_Typography; |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
|
| 11 |
class Easyel_Search_Widget extends \Elementor\Widget_Base { |
| 12 |
|
| 13 |
public function get_name() { |
| 14 |
return 'eel-search'; |
| 15 |
} |
| 16 |
|
| 17 |
public function get_title() { |
| 18 |
return __( 'Search', 'easy-elements' ); |
| 19 |
} |
| 20 |
|
| 21 |
public function get_icon() { |
| 22 |
return 'easyicon easyelIcon-search'; |
| 23 |
} |
| 24 |
|
| 25 |
public function get_categories() { |
| 26 |
return [ 'easyelements_header_footer_category' ]; |
| 27 |
} |
| 28 |
|
| 29 |
public function get_keywords() { |
| 30 |
return [ 'search', 'input', 'field', 'click', 'text' ]; |
| 31 |
} |
| 32 |
|
| 33 |
public function get_style_depends() { |
| 34 |
return [ |
| 35 |
'eel-search', |
| 36 |
]; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_script_depends() { |
| 40 |
return [ |
| 41 |
'eel-search', |
| 42 |
]; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
protected function register_controls() { |
| 47 |
|
| 48 |
/* ------------------------------------------------------------------- |
| 49 |
* CONTENT TAB — Search Settings |
| 50 |
* ----------------------------------------------------------------- */ |
| 51 |
$this->start_controls_section( |
| 52 |
'content_section', |
| 53 |
[ |
| 54 |
'label' => esc_html__( 'Search Settings', 'easy-elements' ), |
| 55 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 56 |
] |
| 57 |
); |
| 58 |
|
| 59 |
$this->add_control( |
| 60 |
'select_style', |
| 61 |
[ |
| 62 |
'label' => esc_html__( 'Search Skin', 'easy-elements' ), |
| 63 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 64 |
'default' => '1', |
| 65 |
'options' => [ |
| 66 |
'1' => esc_html__( 'Search Popup', 'easy-elements' ), |
| 67 |
'2' => esc_html__( 'Search Fields', 'easy-elements' ), |
| 68 |
], |
| 69 |
] |
| 70 |
); |
| 71 |
|
| 72 |
$this->add_control( |
| 73 |
'search_top_title', |
| 74 |
[ |
| 75 |
'label' => esc_html__( 'Search Title', 'easy-elements' ), |
| 76 |
'type' => Controls_Manager::TEXT, |
| 77 |
'condition' => [ |
| 78 |
'select_style' => '1', |
| 79 |
], |
| 80 |
] |
| 81 |
); |
| 82 |
|
| 83 |
$this->add_control( |
| 84 |
'search_placeholder', |
| 85 |
[ |
| 86 |
'label' => esc_html__( 'Search Placeholder', 'easy-elements' ), |
| 87 |
'type' => Controls_Manager::TEXT, |
| 88 |
'default' => esc_html__( 'Type keywords here...', 'easy-elements' ), |
| 89 |
] |
| 90 |
); |
| 91 |
|
| 92 |
$this->add_control( |
| 93 |
'open_icon', |
| 94 |
[ |
| 95 |
'label' => esc_html__( 'Search Icon', 'easy-elements' ), |
| 96 |
'type' => \Elementor\Controls_Manager::ICONS, |
| 97 |
'default' => [ |
| 98 |
'value' => 'fas fa-search', |
| 99 |
'library' => 'fa-solid', |
| 100 |
], |
| 101 |
] |
| 102 |
); |
| 103 |
|
| 104 |
$this->add_control( |
| 105 |
'close_icon', |
| 106 |
[ |
| 107 |
'label' => esc_html__( 'Close Icon', 'easy-elements' ), |
| 108 |
'type' => \Elementor\Controls_Manager::ICONS, |
| 109 |
'default' => [ |
| 110 |
'value' => 'fas fa-arrow-up', |
| 111 |
'library' => 'fa-solid', |
| 112 |
], |
| 113 |
'condition' => [ |
| 114 |
'select_style' => '1', |
| 115 |
], |
| 116 |
] |
| 117 |
); |
| 118 |
|
| 119 |
$this->end_controls_section(); |
| 120 |
|
| 121 |
|
| 122 |
/* ------------------------------------------------------------------- |
| 123 |
* STYLE TAB — Search Icon |
| 124 |
* ----------------------------------------------------------------- */ |
| 125 |
$this->start_controls_section( |
| 126 |
'section_icon_style', |
| 127 |
[ |
| 128 |
'label' => esc_html__( 'Search Icon', 'easy-elements' ), |
| 129 |
'tab' => Controls_Manager::TAB_STYLE, |
| 130 |
] |
| 131 |
); |
| 132 |
|
| 133 |
$this->add_responsive_control( |
| 134 |
'search_icon_size', |
| 135 |
[ |
| 136 |
'label' => esc_html__( 'Icon Size (px)', 'easy-elements' ), |
| 137 |
'type' => Controls_Manager::SLIDER, |
| 138 |
'range' => [ |
| 139 |
'px' => [ |
| 140 |
'min' => 10, |
| 141 |
'max' => 100, |
| 142 |
], |
| 143 |
], |
| 144 |
'selectors' => [ |
| 145 |
'{{WRAPPER}} .eel-search-open-btn i, {{WRAPPER}} .eel-search-open-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 146 |
'{{WRAPPER}} .eel-search-submit-btn i, {{WRAPPER}} .eel-search-submit-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 147 |
], |
| 148 |
] |
| 149 |
); |
| 150 |
|
| 151 |
$this->add_control( |
| 152 |
'icon_colors', |
| 153 |
[ |
| 154 |
'label' => esc_html__( 'Icon Color', 'easy-elements' ), |
| 155 |
'type' => Controls_Manager::COLOR, |
| 156 |
'selectors' => [ |
| 157 |
'{{WRAPPER}} .eel-search-open-btn i' => 'color: {{VALUE}};', |
| 158 |
'{{WRAPPER}} .eel-search-open-btn svg, {{WRAPPER}} .eel-search-open-btn svg path' => 'fill: {{VALUE}};', |
| 159 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn svg' => 'fill: {{VALUE}};', |
| 160 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn svg path' => 'fill: {{VALUE}};', |
| 161 |
], |
| 162 |
] |
| 163 |
); |
| 164 |
|
| 165 |
$this->add_responsive_control( |
| 166 |
'search_icon_vertical_position', |
| 167 |
[ |
| 168 |
'label' => esc_html__( 'Icon Vertical Position (px)', 'easy-elements' ), |
| 169 |
'type' => Controls_Manager::SLIDER, |
| 170 |
'range' => [ |
| 171 |
'px' => [ |
| 172 |
'min' => -50, |
| 173 |
'max' => 50, |
| 174 |
], |
| 175 |
], |
| 176 |
'default' => [ |
| 177 |
'unit' => 'px', |
| 178 |
'size' => 0, |
| 179 |
], |
| 180 |
'selectors' => [ |
| 181 |
'{{WRAPPER}} .eel-search-open-btn' => 'transform: translateY({{SIZE}}{{UNIT}});', |
| 182 |
], |
| 183 |
'condition' => [ |
| 184 |
'select_style' => '1', |
| 185 |
], |
| 186 |
] |
| 187 |
); |
| 188 |
|
| 189 |
$this->add_control( |
| 190 |
'search_icon_position_side', |
| 191 |
[ |
| 192 |
'label' => esc_html__( 'Icon Position', 'easy-elements' ), |
| 193 |
'type' => Controls_Manager::CHOOSE, |
| 194 |
'options' => [ |
| 195 |
'left' => [ |
| 196 |
'title' => esc_html__( 'Left', 'easy-elements' ), |
| 197 |
'icon' => 'eicon-h-align-left', |
| 198 |
], |
| 199 |
'right' => [ |
| 200 |
'title' => esc_html__( 'Right', 'easy-elements' ), |
| 201 |
'icon' => 'eicon-h-align-right', |
| 202 |
], |
| 203 |
], |
| 204 |
'default' => 'right', |
| 205 |
'toggle' => false, |
| 206 |
// Anchor the icon to the chosen side immediately (resetting the |
| 207 |
// opposite side) so picking "Left" moves it without needing an |
| 208 |
// offset value. The offset sliders below only fine-tune it. |
| 209 |
'selectors_dictionary' => [ |
| 210 |
'left' => 'right: auto; left: 0;', |
| 211 |
'right' => 'left: auto;', |
| 212 |
], |
| 213 |
'selectors' => [ |
| 214 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn' => '{{VALUE}}', |
| 215 |
], |
| 216 |
'condition' => [ |
| 217 |
'select_style' => '2', |
| 218 |
], |
| 219 |
] |
| 220 |
); |
| 221 |
|
| 222 |
$this->add_responsive_control( |
| 223 |
'search_icon_horizontal_position', |
| 224 |
[ |
| 225 |
'label' => esc_html__( 'Offset From Right', 'easy-elements' ), |
| 226 |
'type' => Controls_Manager::SLIDER, |
| 227 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 228 |
'range' => [ |
| 229 |
'px' => [ |
| 230 |
'min' => -50, |
| 231 |
'max' => 100, |
| 232 |
], |
| 233 |
], |
| 234 |
'selectors' => [ |
| 235 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn' => 'right: {{SIZE}}{{UNIT}}; left: auto;', |
| 236 |
], |
| 237 |
'condition' => [ |
| 238 |
'select_style' => '2', |
| 239 |
'search_icon_position_side' => 'right', |
| 240 |
], |
| 241 |
] |
| 242 |
); |
| 243 |
|
| 244 |
$this->add_responsive_control( |
| 245 |
'search_icon_horizontal_position_left', |
| 246 |
[ |
| 247 |
'label' => esc_html__( 'Offset From Left', 'easy-elements' ), |
| 248 |
'type' => Controls_Manager::SLIDER, |
| 249 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 250 |
'range' => [ |
| 251 |
'px' => [ |
| 252 |
'min' => -50, |
| 253 |
'max' => 100, |
| 254 |
], |
| 255 |
], |
| 256 |
'selectors' => [ |
| 257 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn' => 'left: {{SIZE}}{{UNIT}}; right: auto;', |
| 258 |
], |
| 259 |
'condition' => [ |
| 260 |
'select_style' => '2', |
| 261 |
'search_icon_position_side' => 'left', |
| 262 |
], |
| 263 |
] |
| 264 |
); |
| 265 |
|
| 266 |
$this->end_controls_section(); |
| 267 |
|
| 268 |
|
| 269 |
/* ------------------------------------------------------------------- |
| 270 |
* STYLE TAB — Input Field |
| 271 |
* ----------------------------------------------------------------- */ |
| 272 |
$this->start_controls_section( |
| 273 |
'section_input_style', |
| 274 |
[ |
| 275 |
'label' => esc_html__( 'Input Field', 'easy-elements' ), |
| 276 |
'tab' => Controls_Manager::TAB_STYLE, |
| 277 |
] |
| 278 |
); |
| 279 |
|
| 280 |
$this->add_group_control( |
| 281 |
Group_Control_Typography::get_type(), |
| 282 |
[ |
| 283 |
'name' => 'input_typography', |
| 284 |
'label' => esc_html__( 'Typography', 'easy-elements' ), |
| 285 |
'selector' => '{{WRAPPER}} .eel-search-content .eel-search-field, {{WRAPPER}} .eel-search-style-2 .eel-search-field', |
| 286 |
] |
| 287 |
); |
| 288 |
|
| 289 |
$this->add_control( |
| 290 |
'input_text_color', |
| 291 |
[ |
| 292 |
'label' => esc_html__( 'Input Text Color', 'easy-elements' ), |
| 293 |
'type' => Controls_Manager::COLOR, |
| 294 |
'selectors' => [ |
| 295 |
'{{WRAPPER}} .eel-search-content .eel-search-field' => 'color: {{VALUE}};', |
| 296 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'color: {{VALUE}};', |
| 297 |
], |
| 298 |
] |
| 299 |
); |
| 300 |
|
| 301 |
$this->add_control( |
| 302 |
'input_placeholder_color', |
| 303 |
[ |
| 304 |
'label' => esc_html__( 'Placeholder Color', 'easy-elements' ), |
| 305 |
'type' => Controls_Manager::COLOR, |
| 306 |
'selectors' => [ |
| 307 |
'{{WRAPPER}} .eel-search-content .eel-search-field::placeholder' => 'color: {{VALUE}};', |
| 308 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field::placeholder' => 'color: {{VALUE}};', |
| 309 |
], |
| 310 |
] |
| 311 |
); |
| 312 |
|
| 313 |
$this->add_control( |
| 314 |
'input_bg_color', |
| 315 |
[ |
| 316 |
'label' => esc_html__( 'Input Background Color', 'easy-elements' ), |
| 317 |
'type' => Controls_Manager::COLOR, |
| 318 |
'selectors' => [ |
| 319 |
'{{WRAPPER}} .eel-search-content .eel-search-field' => 'background-color: {{VALUE}};', |
| 320 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'background: {{VALUE}};', |
| 321 |
], |
| 322 |
] |
| 323 |
); |
| 324 |
|
| 325 |
$this->add_responsive_control( |
| 326 |
'input_padding', |
| 327 |
[ |
| 328 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 329 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 330 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 331 |
'selectors' => [ |
| 332 |
'{{WRAPPER}} .eel-search-content .eel-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 333 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 334 |
], |
| 335 |
] |
| 336 |
); |
| 337 |
|
| 338 |
$this->add_responsive_control( |
| 339 |
'input_height', |
| 340 |
[ |
| 341 |
'label' => esc_html__( 'Height', 'easy-elements' ), |
| 342 |
'type' => Controls_Manager::SLIDER, |
| 343 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 344 |
'range' => [ |
| 345 |
'px' => [ |
| 346 |
'min' => 0, |
| 347 |
'max' => 150, |
| 348 |
], |
| 349 |
], |
| 350 |
'selectors' => [ |
| 351 |
'{{WRAPPER}} .eel-search-content .eel-search-field' => 'height: {{SIZE}}{{UNIT}};', |
| 352 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'height: {{SIZE}}{{UNIT}};', |
| 353 |
], |
| 354 |
] |
| 355 |
); |
| 356 |
|
| 357 |
$this->add_responsive_control( |
| 358 |
'search_input_field_width', |
| 359 |
[ |
| 360 |
'label' => esc_html__( 'Input Field Width', 'easy-elements' ), |
| 361 |
'type' => Controls_Manager::SLIDER, |
| 362 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 363 |
'range' => [ |
| 364 |
'px' => [ |
| 365 |
'min' => 10, |
| 366 |
'max' => 100, |
| 367 |
], |
| 368 |
], |
| 369 |
'selectors' => [ |
| 370 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'width: {{SIZE}}{{UNIT}};', |
| 371 |
], |
| 372 |
'condition' => [ |
| 373 |
'select_style' => '2', |
| 374 |
], |
| 375 |
] |
| 376 |
); |
| 377 |
|
| 378 |
$this->add_responsive_control( |
| 379 |
'input_field_border_radius', |
| 380 |
[ |
| 381 |
'label' => esc_html__( 'Border Radius', 'easy-elements' ), |
| 382 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 383 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 384 |
'selectors' => [ |
| 385 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 386 |
], |
| 387 |
'condition' => [ |
| 388 |
'select_style' => '2', |
| 389 |
], |
| 390 |
] |
| 391 |
); |
| 392 |
|
| 393 |
$this->add_control( |
| 394 |
'input_border_color', |
| 395 |
[ |
| 396 |
'label' => esc_html__( 'Input Border Color', 'easy-elements' ), |
| 397 |
'type' => Controls_Manager::COLOR, |
| 398 |
'selectors' => [ |
| 399 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field' => 'border-color: {{VALUE}};', |
| 400 |
], |
| 401 |
'condition' => [ |
| 402 |
'select_style' => '2', |
| 403 |
], |
| 404 |
] |
| 405 |
); |
| 406 |
|
| 407 |
$this->add_control( |
| 408 |
'input_focus_border_color', |
| 409 |
[ |
| 410 |
'label' => esc_html__( 'Border Color (Focus)', 'easy-elements' ), |
| 411 |
'type' => Controls_Manager::COLOR, |
| 412 |
'selectors' => [ |
| 413 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-field:focus' => 'border-color: {{VALUE}};', |
| 414 |
], |
| 415 |
'condition' => [ |
| 416 |
'select_style' => '2', |
| 417 |
], |
| 418 |
] |
| 419 |
); |
| 420 |
|
| 421 |
$this->end_controls_section(); |
| 422 |
|
| 423 |
|
| 424 |
/* ------------------------------------------------------------------- |
| 425 |
* STYLE TAB — Submit Button |
| 426 |
* ----------------------------------------------------------------- */ |
| 427 |
$this->start_controls_section( |
| 428 |
'section_submit_style', |
| 429 |
[ |
| 430 |
'label' => esc_html__( 'Submit Button', 'easy-elements' ), |
| 431 |
'tab' => Controls_Manager::TAB_STYLE, |
| 432 |
] |
| 433 |
); |
| 434 |
|
| 435 |
$this->add_control( |
| 436 |
'submit_btn_icon_color', |
| 437 |
[ |
| 438 |
'label' => esc_html__( 'Submit Icon Color', 'easy-elements' ), |
| 439 |
'type' => Controls_Manager::COLOR, |
| 440 |
'selectors' => [ |
| 441 |
'{{WRAPPER}} .eel-search-content .eel-search-submit' => 'color: {{VALUE}};', |
| 442 |
'{{WRAPPER}} .eel-search-content .eel-search-submit svg' => 'fill: {{VALUE}};', |
| 443 |
], |
| 444 |
'condition' => [ |
| 445 |
'select_style' => '1', |
| 446 |
], |
| 447 |
] |
| 448 |
); |
| 449 |
|
| 450 |
$this->add_control( |
| 451 |
'submit_btn_icon_h_color', |
| 452 |
[ |
| 453 |
'label' => esc_html__( 'Submit Icon Hover Color', 'easy-elements' ), |
| 454 |
'type' => Controls_Manager::COLOR, |
| 455 |
'selectors' => [ |
| 456 |
'{{WRAPPER}} .eel-search-content .eel-search-submit:hover' => 'color: {{VALUE}};', |
| 457 |
'{{WRAPPER}} .eel-search-content .eel-search-submit:hover svg' => 'fill: {{VALUE}};', |
| 458 |
], |
| 459 |
'condition' => [ |
| 460 |
'select_style' => '1', |
| 461 |
], |
| 462 |
] |
| 463 |
); |
| 464 |
|
| 465 |
$this->add_control( |
| 466 |
'submit_button_color', |
| 467 |
[ |
| 468 |
'label' => esc_html__( 'Submit Icon Background', 'easy-elements' ), |
| 469 |
'type' => Controls_Manager::COLOR, |
| 470 |
'selectors' => [ |
| 471 |
'{{WRAPPER}} .eel-search-content .eel-search-submit' => 'background-color: {{VALUE}};', |
| 472 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn' => 'background-color: {{VALUE}};', |
| 473 |
], |
| 474 |
'condition' => [ |
| 475 |
'select_style' => [ '1', '2' ], |
| 476 |
], |
| 477 |
] |
| 478 |
); |
| 479 |
|
| 480 |
$this->add_control( |
| 481 |
'submit_button_hover_bgcolor', |
| 482 |
[ |
| 483 |
'label' => esc_html__( 'Submit Icon Hover Background', 'easy-elements' ), |
| 484 |
'type' => Controls_Manager::COLOR, |
| 485 |
'selectors' => [ |
| 486 |
'{{WRAPPER}} .eel-search-content .eel-search-submit:hover' => 'background-color: {{VALUE}};', |
| 487 |
], |
| 488 |
'condition' => [ |
| 489 |
'select_style' => '1', |
| 490 |
], |
| 491 |
] |
| 492 |
); |
| 493 |
|
| 494 |
$this->add_responsive_control( |
| 495 |
'submit_button_padding', |
| 496 |
[ |
| 497 |
'label' => esc_html__( 'Padding', 'easy-elements' ), |
| 498 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 499 |
'size_units' => [ 'px', '%', 'em', 'rem' ], |
| 500 |
'selectors' => [ |
| 501 |
'{{WRAPPER}} .eel-search-content .eel-search-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 502 |
'{{WRAPPER}} .eel-search-style-2 .eel-search-submit-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 503 |
], |
| 504 |
] |
| 505 |
); |
| 506 |
|
| 507 |
$this->end_controls_section(); |
| 508 |
|
| 509 |
|
| 510 |
/* ------------------------------------------------------------------- |
| 511 |
* STYLE TAB — Search Popup (Skin: Search Popup only) |
| 512 |
* ----------------------------------------------------------------- */ |
| 513 |
$this->start_controls_section( |
| 514 |
'section_popup_style', |
| 515 |
[ |
| 516 |
'label' => esc_html__( 'Search Popup', 'easy-elements' ), |
| 517 |
'tab' => Controls_Manager::TAB_STYLE, |
| 518 |
'condition' => [ |
| 519 |
'select_style' => '1', |
| 520 |
], |
| 521 |
] |
| 522 |
); |
| 523 |
|
| 524 |
$this->add_control( |
| 525 |
'overlay_background', |
| 526 |
[ |
| 527 |
'label' => esc_html__( 'Overlay Background', 'easy-elements' ), |
| 528 |
'type' => Controls_Manager::COLOR, |
| 529 |
'default' => '', |
| 530 |
'selectors' => [ |
| 531 |
'{{WRAPPER}} .eel-search-lightbox, {{WRAPPER}} .eel-search-overlay' => 'background: {{VALUE}};', |
| 532 |
], |
| 533 |
] |
| 534 |
); |
| 535 |
|
| 536 |
$this->add_control( |
| 537 |
'popup_title_heading', |
| 538 |
[ |
| 539 |
'label' => esc_html__( 'Title', 'easy-elements' ), |
| 540 |
'type' => Controls_Manager::HEADING, |
| 541 |
'separator' => 'before', |
| 542 |
] |
| 543 |
); |
| 544 |
|
| 545 |
$this->add_control( |
| 546 |
'popup_title_color', |
| 547 |
[ |
| 548 |
'label' => esc_html__( 'Title Color', 'easy-elements' ), |
| 549 |
'type' => Controls_Manager::COLOR, |
| 550 |
'selectors' => [ |
| 551 |
'{{WRAPPER}} .eel-search-title' => 'color: {{VALUE}};', |
| 552 |
], |
| 553 |
] |
| 554 |
); |
| 555 |
|
| 556 |
$this->add_group_control( |
| 557 |
Group_Control_Typography::get_type(), |
| 558 |
[ |
| 559 |
'name' => 'popup_title_typography', |
| 560 |
'label' => esc_html__( 'Title Typography', 'easy-elements' ), |
| 561 |
'selector' => '{{WRAPPER}} .eel-search-title', |
| 562 |
] |
| 563 |
); |
| 564 |
|
| 565 |
$this->add_control( |
| 566 |
'close_icon_heading', |
| 567 |
[ |
| 568 |
'label' => esc_html__( 'Close Icon', 'easy-elements' ), |
| 569 |
'type' => Controls_Manager::HEADING, |
| 570 |
'separator' => 'before', |
| 571 |
] |
| 572 |
); |
| 573 |
|
| 574 |
$this->add_control( |
| 575 |
'close_icon_color', |
| 576 |
[ |
| 577 |
'label' => esc_html__( 'Close Icon Color', 'easy-elements' ), |
| 578 |
'type' => Controls_Manager::COLOR, |
| 579 |
'selectors' => [ |
| 580 |
'{{WRAPPER}} .eel-search-close-btn i' => 'color: {{VALUE}};', |
| 581 |
'{{WRAPPER}} .eel-search-close-btn svg, {{WRAPPER}} .eel-search-close-btn svg path' => 'fill: {{VALUE}};', |
| 582 |
], |
| 583 |
] |
| 584 |
); |
| 585 |
|
| 586 |
$this->add_responsive_control( |
| 587 |
'icon_size', |
| 588 |
[ |
| 589 |
'label' => esc_html__( 'Close Icon Size (px)', 'easy-elements' ), |
| 590 |
'type' => Controls_Manager::SLIDER, |
| 591 |
'range' => [ |
| 592 |
'px' => [ |
| 593 |
'min' => 10, |
| 594 |
'max' => 100, |
| 595 |
], |
| 596 |
], |
| 597 |
'selectors' => [ |
| 598 |
'{{WRAPPER}} .eel-search-close-btn i, {{WRAPPER}} .eel-search-close-btn svg' => 'font-size: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 599 |
], |
| 600 |
] |
| 601 |
); |
| 602 |
|
| 603 |
$this->end_controls_section(); |
| 604 |
} |
| 605 |
|
| 606 |
protected function render() { |
| 607 |
$settings = $this->get_settings_for_display(); |
| 608 |
$style = $settings['select_style']; |
| 609 |
|
| 610 |
if ( $style == '2' ) : ?> |
| 611 |
<div class="eel-search-style-<?php echo esc_attr( $style ); ?>"> |
| 612 |
<form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> |
| 613 |
<input type="search" class="eel-search-field" placeholder="<?php echo esc_attr( $settings['search_placeholder'] ?? 'Search..' ); ?>" value="" name="s" /> |
| 614 |
<button type="submit" class="eel-search-submit-btn" aria-label="Submit Search"> |
| 615 |
<?php |
| 616 |
if( $settings['open_icon']['value'] ) : |
| 617 |
\Elementor\Icons_Manager::render_icon( $settings['open_icon'], [ 'aria-hidden' => 'true' ] ); |
| 618 |
else : ?> |
| 619 |
<i class="eel-absl unicon-search"></i> |
| 620 |
<?php |
| 621 |
endif; ?> |
| 622 |
</button> |
| 623 |
</form> |
| 624 |
</div> |
| 625 |
<?php |
| 626 |
else: ?> |
| 627 |
<a href="#" role="button" class="eel-search-open-btn" aria-label="<?php esc_attr_e('Open Search', 'easy-elements'); ?>"> |
| 628 |
<?php \Elementor\Icons_Manager::render_icon( $settings['open_icon'], [ 'aria-hidden' => 'true' ] ); ?> |
| 629 |
</a> |
| 630 |
|
| 631 |
<div class="eel-search-lightbox"> |
| 632 |
<div class="eel-search-overlay"> |
| 633 |
<a href="#" role="button" class="eel-search-close-btn" aria-label="<?php esc_attr_e('Close Search', 'easy-elements'); ?>"> |
| 634 |
<?php \Elementor\Icons_Manager::render_icon( $settings['close_icon'], [ 'aria-hidden' => 'true' ] ); ?> |
| 635 |
</a> |
| 636 |
</div> |
| 637 |
<div class="eel-search-content"> |
| 638 |
<div class="eel-search-title"> |
| 639 |
<?php echo esc_attr( $settings['search_top_title'] ?: __( 'What are you looking for?', 'easy-elements' ) ); ?> |
| 640 |
</div> |
| 641 |
<form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> |
| 642 |
<input type="search" class="eel-search-field" placeholder="<?php echo esc_attr( $settings['search_placeholder'] ?? 'Type keywords here...' ); ?>" value="" name="s" /> |
| 643 |
<button type="submit" class="eel-search-submit" aria-label="Submit Search"> |
| 644 |
<i class="eel-absl unicon-search"></i> |
| 645 |
</button> |
| 646 |
</form> |
| 647 |
</div> |
| 648 |
</div> |
| 649 |
<?php |
| 650 |
endif; |
| 651 |
} |
| 652 |
} |
| 653 |
|