dep
5 years ago
premium-banner.php
5 years ago
premium-blog.php
5 years ago
premium-button.php
5 years ago
premium-carousel.php
5 years ago
premium-contactform.php
5 years ago
premium-countdown.php
5 years ago
premium-counter.php
5 years ago
premium-dual-header.php
5 years ago
premium-fancytext.php
5 years ago
premium-grid.php
5 years ago
premium-icon-list.php
5 years ago
premium-image-button.php
5 years ago
premium-image-scroll.php
5 years ago
premium-image-separator.php
5 years ago
premium-lottie.php
5 years ago
premium-maps.php
5 years ago
premium-modalbox.php
5 years ago
premium-person.php
5 years ago
premium-pricing-table.php
5 years ago
premium-progressbar.php
5 years ago
premium-testimonials.php
5 years ago
premium-title.php
5 years ago
premium-videobox.php
5 years ago
premium-vscroll.php
5 years ago
premium-contactform.php
623 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Premium Contact Form 7. |
| 5 | */ |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Widget_Base; |
| 10 | use Elementor\Controls_Manager; |
| 11 | use Elementor\Scheme_Color; |
| 12 | use Elementor\Scheme_Typography; |
| 13 | use Elementor\Group_Control_Border; |
| 14 | use Elementor\Group_Control_Typography; |
| 15 | use Elementor\Group_Control_Box_Shadow; |
| 16 | |
| 17 | // PremiumAddons Classes. |
| 18 | use PremiumAddons\Includes\Helper_Functions; |
| 19 | |
| 20 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 21 | |
| 22 | /** |
| 23 | * Class Premium_Contactform |
| 24 | */ |
| 25 | class Premium_Contactform extends Widget_Base { |
| 26 | |
| 27 | public function get_name() { |
| 28 | return 'premium-contact-form'; |
| 29 | } |
| 30 | |
| 31 | public function get_title() { |
| 32 | return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Contact Form7', 'premium-addons-for-elementor') ); |
| 33 | } |
| 34 | |
| 35 | public function get_icon() { |
| 36 | return 'pa-contact-form'; |
| 37 | } |
| 38 | |
| 39 | public function get_categories() { |
| 40 | return array( 'premium-elements' ); |
| 41 | } |
| 42 | |
| 43 | public function get_style_depends() { |
| 44 | return [ |
| 45 | 'premium-addons' |
| 46 | ]; |
| 47 | } |
| 48 | |
| 49 | public function get_script_depends() { |
| 50 | return [ |
| 51 | 'premium-addons' |
| 52 | ]; |
| 53 | } |
| 54 | |
| 55 | public function get_custom_help_url() { |
| 56 | return 'https://premiumaddons.com/support/'; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Register Contact Form 7 controls. |
| 61 | * |
| 62 | * @since 1.0.0 |
| 63 | * @access protected |
| 64 | */ |
| 65 | protected function _register_controls() { |
| 66 | |
| 67 | $this->start_controls_section('premium_section_wpcf7_form', |
| 68 | [ |
| 69 | 'label' => __( 'Contact Form', 'premium-addons-for-elementor' ) |
| 70 | ] |
| 71 | ); |
| 72 | |
| 73 | |
| 74 | $this->add_control('premium_wpcf7_form', |
| 75 | [ |
| 76 | 'label' => __( 'Select Your Contact Form', 'premium-addons-for-elementor' ), |
| 77 | 'label_block' => true, |
| 78 | 'type' => Controls_Manager::SELECT, |
| 79 | 'options' => $this->get_wpcf_forms(), |
| 80 | ] |
| 81 | ); |
| 82 | |
| 83 | |
| 84 | $this->end_controls_section(); |
| 85 | |
| 86 | $this->start_controls_section('premium_wpcf7_fields', |
| 87 | [ |
| 88 | 'label' => __('Fields', 'premium-addons-for-elementor'), |
| 89 | ] |
| 90 | ); |
| 91 | |
| 92 | $this->add_control('premium_wpcf7_fields_heading', |
| 93 | [ |
| 94 | 'label' => __('Width', 'premium-addons-for-elementor'), |
| 95 | 'type' => Controls_Manager::HEADING |
| 96 | ] |
| 97 | ); |
| 98 | |
| 99 | $this->add_responsive_control('premium_elements_input_width', |
| 100 | [ |
| 101 | 'label' => __( 'Input Field', 'premium-addons-for-elementor' ), |
| 102 | 'type' => Controls_Manager::SLIDER, |
| 103 | 'size_units' => [ 'px', 'em', '%' ], |
| 104 | 'range' => [ |
| 105 | 'px' => [ |
| 106 | 'min' => 10, |
| 107 | 'max' => 1200, |
| 108 | ], |
| 109 | 'em' => [ |
| 110 | 'min' => 1, |
| 111 | 'max' => 80, |
| 112 | ], |
| 113 | ], |
| 114 | 'default' => [ |
| 115 | 'size' => 100, |
| 116 | 'unit' => '%' |
| 117 | ], |
| 118 | 'selectors' => [ |
| 119 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-text, {{WRAPPER}} .premium-cf7-container .wpcf7-file' => 'width: {{SIZE}}{{UNIT}};', |
| 120 | ], |
| 121 | ] |
| 122 | ); |
| 123 | |
| 124 | $this->add_responsive_control('premium_elements_textarea_width', |
| 125 | [ |
| 126 | 'label' => __( 'Text Area', 'premium-addons-for-elementor' ), |
| 127 | 'type' => Controls_Manager::SLIDER, |
| 128 | 'size_units' => [ 'px', 'em', '%' ], |
| 129 | 'range' => [ |
| 130 | 'px' => [ |
| 131 | 'min' => 10, |
| 132 | 'max' => 1200, |
| 133 | ], |
| 134 | 'em' => [ |
| 135 | 'min' => 1, |
| 136 | 'max' => 80, |
| 137 | ], |
| 138 | ], |
| 139 | 'default' => [ |
| 140 | 'size' => 100, |
| 141 | 'unit' => '%' |
| 142 | ], |
| 143 | 'selectors' => [ |
| 144 | '{{WRAPPER}} .premium-cf7-container textarea.wpcf7-textarea' => 'width: {{SIZE}}{{UNIT}};', |
| 145 | ], |
| 146 | ] |
| 147 | ); |
| 148 | |
| 149 | $this->add_control('premium_wpcf7_fields_height_heading', |
| 150 | [ |
| 151 | 'label' => __('Height', 'premium-addons-for-elementor'), |
| 152 | 'type' => Controls_Manager::HEADING |
| 153 | ] |
| 154 | ); |
| 155 | |
| 156 | $this->add_responsive_control('premium_elements_input_height', |
| 157 | [ |
| 158 | 'label' => __( 'Input Field', 'premium-addons-for-elementor' ), |
| 159 | 'type' => Controls_Manager::SLIDER, |
| 160 | 'size_units' => [ 'px', 'em' ], |
| 161 | 'range' => [ |
| 162 | 'px' => [ |
| 163 | 'min' => 10, |
| 164 | 'max' => 500, |
| 165 | ], |
| 166 | 'em' => [ |
| 167 | 'min' => 1, |
| 168 | 'max' => 40, |
| 169 | ], |
| 170 | ], |
| 171 | 'selectors' => [ |
| 172 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-text' => 'height: {{SIZE}}{{UNIT}};', |
| 173 | ], |
| 174 | ] |
| 175 | ); |
| 176 | |
| 177 | $this->add_responsive_control('premium_elements_textarea_height', |
| 178 | [ |
| 179 | 'label' => __( 'Text Area', 'premium-addons-for-elementor' ), |
| 180 | 'type' => Controls_Manager::SLIDER, |
| 181 | 'size_units' => [ 'px', 'em' ], |
| 182 | 'range' => [ |
| 183 | 'px' => [ |
| 184 | 'min' => 10, |
| 185 | 'max' => 1200, |
| 186 | ], |
| 187 | 'em' => [ |
| 188 | 'min' => 1, |
| 189 | 'max' => 80, |
| 190 | ], |
| 191 | ], |
| 192 | 'selectors' => [ |
| 193 | '{{WRAPPER}} .premium-cf7-container textarea.wpcf7-textarea' => 'height: {{SIZE}}{{UNIT}};', |
| 194 | ], |
| 195 | ] |
| 196 | ); |
| 197 | |
| 198 | $this->end_controls_section(); |
| 199 | |
| 200 | $this->start_controls_section('premium_wpcf7_button', |
| 201 | [ |
| 202 | 'label' => __('Button', 'premium-addons-for-elementor'), |
| 203 | ] |
| 204 | ); |
| 205 | |
| 206 | $this->add_responsive_control('premium_elements_button_width', |
| 207 | [ |
| 208 | 'label' => __( 'Width', 'premium-addons-for-elementor' ), |
| 209 | 'type' => Controls_Manager::SLIDER, |
| 210 | 'size_units' => [ 'px', 'em', '%' ], |
| 211 | 'range' => [ |
| 212 | 'px' => [ |
| 213 | 'min' => 10, |
| 214 | 'max' => 1200, |
| 215 | ], |
| 216 | 'em' => [ |
| 217 | 'min' => 1, |
| 218 | 'max' => 80, |
| 219 | ], |
| 220 | ], |
| 221 | 'selectors' => [ |
| 222 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit' => 'width: {{SIZE}}{{UNIT}};', |
| 223 | ], |
| 224 | ] |
| 225 | ); |
| 226 | |
| 227 | |
| 228 | $this->add_responsive_control('premium_elements_button_height', |
| 229 | [ |
| 230 | 'label' => __( 'Height', 'premium-addons-for-elementor' ), |
| 231 | 'type' => Controls_Manager::SLIDER, |
| 232 | 'size_units' => [ 'px', 'em' ], |
| 233 | 'range' => [ |
| 234 | 'px' => [ |
| 235 | 'min' => 10, |
| 236 | 'max' => 500, |
| 237 | ], |
| 238 | 'em' => [ |
| 239 | 'min' => 1, |
| 240 | 'max' => 40, |
| 241 | ], |
| 242 | ], |
| 243 | 'selectors' => [ |
| 244 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit' => 'height: {{SIZE}}{{UNIT}};', |
| 245 | ], |
| 246 | ] |
| 247 | ); |
| 248 | |
| 249 | $this->end_controls_section(); |
| 250 | |
| 251 | $this->start_controls_section('section_contact_form_styles', |
| 252 | [ |
| 253 | 'label' => __( 'Form', 'premium-addons-for-elementor' ), |
| 254 | 'tab' => Controls_Manager::TAB_STYLE |
| 255 | ] |
| 256 | ); |
| 257 | |
| 258 | $this->add_control('premium_elements_input_background', |
| 259 | [ |
| 260 | 'label' => __( 'Input Field Background', 'premium-addons-for-elementor' ), |
| 261 | 'type' => Controls_Manager::COLOR, |
| 262 | 'selectors' => [ |
| 263 | '{{WRAPPER}} .premium-cf7-container input, {{WRAPPER}} .premium-cf7-container textarea' => 'background: {{VALUE}}', |
| 264 | ] |
| 265 | ] |
| 266 | ); |
| 267 | |
| 268 | $this->add_responsive_control('premium_elements_input_padding', |
| 269 | [ |
| 270 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 271 | 'type' => Controls_Manager::DIMENSIONS, |
| 272 | 'size_units' => [ 'px', 'em', '%' ], |
| 273 | 'selectors' => [ |
| 274 | '{{WRAPPER}} .premium-cf7-container input, {{WRAPPER}} .premium-cf7-container textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 275 | ], |
| 276 | ] |
| 277 | ); |
| 278 | |
| 279 | $this->add_group_control( |
| 280 | Group_Control_Border::get_type(), |
| 281 | [ |
| 282 | 'name' => 'premium_elements_input_border', |
| 283 | 'selector' => '{{WRAPPER}} .premium-cf7-container input, {{WRAPPER}} .premium-cf7-container textarea', |
| 284 | ] |
| 285 | ); |
| 286 | |
| 287 | $this->add_responsive_control('premium_elements_input_border_radius', |
| 288 | [ |
| 289 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 290 | 'type' => Controls_Manager::DIMENSIONS, |
| 291 | 'size_units' => [ 'px' ], |
| 292 | 'selectors' => [ |
| 293 | '{{WRAPPER}} .premium-cf7-container input, {{WRAPPER}} .premium-cf7-container textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 294 | ], |
| 295 | ] |
| 296 | ); |
| 297 | |
| 298 | $this->add_responsive_control('premium_elements_input_margin', |
| 299 | [ |
| 300 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 301 | 'type' => Controls_Manager::DIMENSIONS, |
| 302 | 'size_units' => [ 'px', 'em', '%' ], |
| 303 | 'selectors' => [ |
| 304 | '{{WRAPPER}} .premium-cf7-container input, {{WRAPPER}} .premium-cf7-container textarea' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 305 | ], |
| 306 | ] |
| 307 | ); |
| 308 | |
| 309 | $this->add_control('premium_elements_input_focus', |
| 310 | [ |
| 311 | 'label' => __( 'Focus Border Color', 'premium-addons-for-elementor' ), |
| 312 | 'type' => Controls_Manager::COLOR, |
| 313 | 'selectors' => [ |
| 314 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-text:focus, {{WRAPPER}} .premium-cf7-container textarea.wpcf7-textarea:focus , {{WRAPPER}} .premium-cf7-container .wpcf7-file:focus' => 'border-color: {{VALUE}};', |
| 315 | ], |
| 316 | ] |
| 317 | ); |
| 318 | |
| 319 | $this->add_control('premium_elements_input_focus_border_animation', |
| 320 | [ |
| 321 | 'label' => __( 'Focus Border Animation', 'premium-addons-for-elementor' ), |
| 322 | 'type' => Controls_Manager::SWITCHER, |
| 323 | 'prefix_class' => 'premium-contact-form-anim-' |
| 324 | ] |
| 325 | ); |
| 326 | |
| 327 | $this->add_control('premium_elements_input_focus_border_color', |
| 328 | [ |
| 329 | 'label' => __( 'Focus Line Color', 'premium-addons-for-elementor' ), |
| 330 | 'type' => Controls_Manager::COLOR, |
| 331 | 'condition' => [ |
| 332 | 'premium_elements_input_focus_border_animation' => 'yes' |
| 333 | ], |
| 334 | 'selectors' => [ |
| 335 | '{{WRAPPER}}.premium-contact-form-anim-yes .wpcf7-span.is-focused::after' => 'background-color: {{VALUE}};', |
| 336 | ], |
| 337 | ] |
| 338 | ); |
| 339 | |
| 340 | $this->add_group_control( |
| 341 | Group_Control_Box_Shadow::get_type(), |
| 342 | [ |
| 343 | 'name' => 'input_button_shadow', |
| 344 | 'selector' => '{{WRAPPER}} .premium-cf7-container input.wpcf7-text, {{WRAPPER}} .premium-cf7-container textarea.wpcf7-textarea, {{WRAPPER}} .premium-cf7-container .wpcf7-file', |
| 345 | ] |
| 346 | ); |
| 347 | |
| 348 | $this->end_controls_section(); |
| 349 | |
| 350 | |
| 351 | $this->start_controls_section('section_contact_form_typography', |
| 352 | [ |
| 353 | 'label' => __( 'Labels', 'premium-addons-for-elementor' ), |
| 354 | 'tab' => Controls_Manager::TAB_STYLE |
| 355 | ] |
| 356 | ); |
| 357 | |
| 358 | |
| 359 | $this->add_control('premium_elements_heading_default', |
| 360 | [ |
| 361 | 'type' => Controls_Manager::HEADING, |
| 362 | 'label' => __( 'Default Typography', 'premium-addons-for-elementor' ), |
| 363 | ] |
| 364 | ); |
| 365 | |
| 366 | $this->add_control('premium_elements_contact_form_color', |
| 367 | [ |
| 368 | 'label' => __( 'Default Font Color', 'premium-addons-for-elementor' ), |
| 369 | 'type' => Controls_Manager::COLOR, |
| 370 | 'scheme' => [ |
| 371 | 'type' => Scheme_Color::get_type(), |
| 372 | 'value' => Scheme_Color::COLOR_1, |
| 373 | ], |
| 374 | 'selectors' => [ |
| 375 | '{{WRAPPER}} .premium-cf7-container, {{WRAPPER}} .premium-cf7-container label' => 'color: {{VALUE}};', |
| 376 | ], |
| 377 | ] |
| 378 | ); |
| 379 | |
| 380 | $this->add_group_control( |
| 381 | Group_Control_Typography::get_type(), |
| 382 | [ |
| 383 | 'name' => 'premium_elements_contact_form_default_typography', |
| 384 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 385 | 'selector' => '{{WRAPPER}} .premium-cf7-container', |
| 386 | ] |
| 387 | ); |
| 388 | |
| 389 | $this->add_control('premium_elements_heading_input', |
| 390 | [ |
| 391 | 'type' => Controls_Manager::HEADING, |
| 392 | 'label' => __( 'Input Typography', 'premium-addons-for-elementor' ), |
| 393 | 'separator' => 'before', |
| 394 | ] |
| 395 | ); |
| 396 | |
| 397 | $this->add_control('premium_elements_contact_form_field_color', |
| 398 | [ |
| 399 | 'label' => __( 'Input Text Color', 'premium-addons-for-elementor' ), |
| 400 | 'type' => Controls_Manager::COLOR, |
| 401 | 'scheme' => [ |
| 402 | 'type' => Scheme_Color::get_type(), |
| 403 | 'value' => Scheme_Color::COLOR_1, |
| 404 | ], |
| 405 | 'selectors' => [ |
| 406 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-text, {{WRAPPER}} .premium-cf7-container textarea.wpcf7-textarea' => 'color: {{VALUE}};', |
| 407 | ], |
| 408 | ] |
| 409 | ); |
| 410 | |
| 411 | $this->add_group_control( |
| 412 | Group_Control_Typography::get_type(), |
| 413 | [ |
| 414 | 'name' => 'premium_elements_contact_form_field_typography', |
| 415 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 416 | 'selector' => '{{WRAPPER}} .premium-cf7-container input.wpcf7-text, {{WRAPPER}} .premium-cf7-container textarea.wpcf7-textarea', |
| 417 | ] |
| 418 | ); |
| 419 | |
| 420 | |
| 421 | $this->add_control('premium_elements_contact_form_placeholder_color', |
| 422 | [ |
| 423 | 'label' => __( 'Placeholder Color', 'premium-addons-for-elementor' ), |
| 424 | 'type' => Controls_Manager::COLOR, |
| 425 | 'selectors' => [ |
| 426 | '{{WRAPPER}} .premium-cf7-container ::-webkit-input-placeholder' => 'color: {{VALUE}};', |
| 427 | '{{WRAPPER}} .premium-cf7-container ::-moz-placeholder' => 'color: {{VALUE}};', |
| 428 | '{{WRAPPER}} .premium-cf7-container ::-ms-input-placeholder' => 'color: {{VALUE}};', |
| 429 | ], |
| 430 | ] |
| 431 | ); |
| 432 | |
| 433 | |
| 434 | $this->end_controls_section(); |
| 435 | |
| 436 | $this->start_controls_section('section_contact_form_submit_button_styles', |
| 437 | [ |
| 438 | 'label' => __( 'Button', 'premium-addons-for-elementor' ), |
| 439 | 'tab' => Controls_Manager::TAB_STYLE |
| 440 | ] |
| 441 | ); |
| 442 | |
| 443 | $this->add_group_control( |
| 444 | Group_Control_Typography::get_type(), |
| 445 | [ |
| 446 | 'name' => 'section_title_premium_btn_typography', |
| 447 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 448 | 'selector' => '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit', |
| 449 | ] |
| 450 | ); |
| 451 | |
| 452 | $this->add_responsive_control('section_title_premium_btn_padding', |
| 453 | [ |
| 454 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 455 | 'type' => Controls_Manager::DIMENSIONS, |
| 456 | 'size_units' => [ 'px', 'em', '%' ], |
| 457 | 'selectors' => [ |
| 458 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 459 | ], |
| 460 | ] |
| 461 | ); |
| 462 | |
| 463 | |
| 464 | |
| 465 | $this->start_controls_tabs( 'premium_elements_button_tabs' ); |
| 466 | |
| 467 | $this->start_controls_tab( 'normal', [ 'label' => __( 'Normal', 'premium-addons-for-elementor' ) ] ); |
| 468 | |
| 469 | $this->add_control('premium_elements_button_text_color', |
| 470 | [ |
| 471 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 472 | 'type' => Controls_Manager::COLOR, |
| 473 | 'selectors' => [ |
| 474 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit' => 'color: {{VALUE}};', |
| 475 | ], |
| 476 | ] |
| 477 | ); |
| 478 | |
| 479 | $this->add_control('premium_elements_button_background_color', |
| 480 | [ |
| 481 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 482 | 'type' => Controls_Manager::COLOR, |
| 483 | 'scheme' => [ |
| 484 | 'type' => Scheme_Color::get_type(), |
| 485 | 'value' => Scheme_Color::COLOR_1, |
| 486 | ], |
| 487 | 'selectors' => [ |
| 488 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit' => 'background-color: {{VALUE}};', |
| 489 | ], |
| 490 | ] |
| 491 | ); |
| 492 | |
| 493 | $this->add_group_control( |
| 494 | Group_Control_Border::get_type(), |
| 495 | [ |
| 496 | 'name' => 'premium_elements_btn_border', |
| 497 | 'selector' => '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit', |
| 498 | ] |
| 499 | ); |
| 500 | |
| 501 | $this->add_responsive_control('premium_elements_btn_border_radius', |
| 502 | [ |
| 503 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 504 | 'type' => Controls_Manager::SLIDER, |
| 505 | 'range' => [ |
| 506 | 'px' => [ |
| 507 | 'max' => 100, |
| 508 | ], |
| 509 | ], |
| 510 | 'selectors' => [ |
| 511 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit' => 'border-radius: {{SIZE}}px;', |
| 512 | ], |
| 513 | ] |
| 514 | ); |
| 515 | |
| 516 | $this->end_controls_tab(); |
| 517 | |
| 518 | $this->start_controls_tab('premium_elements_hover', |
| 519 | [ |
| 520 | 'label' => __( 'Hover', 'premium-addons-for-elementor' ) |
| 521 | ] |
| 522 | ); |
| 523 | |
| 524 | $this->add_control('premium_elements_button_hover_text_color', |
| 525 | [ |
| 526 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 527 | 'type' => Controls_Manager::COLOR, |
| 528 | 'selectors' => [ |
| 529 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit:hover' => 'color: {{VALUE}};', |
| 530 | ], |
| 531 | ] |
| 532 | ); |
| 533 | |
| 534 | $this->add_control('premium_elements_button_hover_background_color', |
| 535 | [ |
| 536 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 537 | 'type' => Controls_Manager::COLOR, |
| 538 | 'selectors' => [ |
| 539 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit:hover' => 'background-color: {{VALUE}};', |
| 540 | ], |
| 541 | ] |
| 542 | ); |
| 543 | |
| 544 | $this->add_control('premium_elements_button_hover_border_color', |
| 545 | [ |
| 546 | 'label' => __( 'Border Color', 'premium-addons-for-elementor' ), |
| 547 | 'type' => Controls_Manager::COLOR, |
| 548 | 'selectors' => [ |
| 549 | '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit:hover' => 'border-color: {{VALUE}};', |
| 550 | ], |
| 551 | ] |
| 552 | ); |
| 553 | |
| 554 | $this->end_controls_tab(); |
| 555 | |
| 556 | $this->end_controls_tabs(); |
| 557 | |
| 558 | |
| 559 | $this->add_group_control( |
| 560 | Group_Control_Box_Shadow::get_type(), |
| 561 | [ |
| 562 | 'name' => 'button_box_shadow', |
| 563 | 'selector' => '{{WRAPPER}} .premium-cf7-container input.wpcf7-submit', |
| 564 | ] |
| 565 | ); |
| 566 | |
| 567 | $this->end_controls_section(); |
| 568 | |
| 569 | |
| 570 | } |
| 571 | |
| 572 | protected function get_wpcf_forms() { |
| 573 | |
| 574 | if ( ! class_exists( 'WPCF7_ContactForm' ) ) { |
| 575 | return array(); |
| 576 | } |
| 577 | |
| 578 | $forms = \WPCF7_ContactForm::find( array( |
| 579 | 'orderby' => 'title', |
| 580 | 'order' => 'ASC', |
| 581 | ) ); |
| 582 | |
| 583 | if ( empty( $forms ) ) { |
| 584 | return array(); |
| 585 | } |
| 586 | |
| 587 | $result = array(); |
| 588 | |
| 589 | foreach ( $forms as $item ) { |
| 590 | $key = sprintf( '%1$s::%2$s', $item->id(), $item->title() ); |
| 591 | $result[ $key ] = $item->title(); |
| 592 | } |
| 593 | |
| 594 | return $result; |
| 595 | } |
| 596 | |
| 597 | /** |
| 598 | * Render Contact Form 7 widget output on the frontend. |
| 599 | * |
| 600 | * Written in PHP and used to generate the final HTML. |
| 601 | * |
| 602 | * @since 1.0.0 |
| 603 | * @access protected |
| 604 | */ |
| 605 | protected function render() { |
| 606 | |
| 607 | $settings = $this->get_settings(); |
| 608 | |
| 609 | if ( ! empty( $settings['premium_wpcf7_form'] ) ) { |
| 610 | |
| 611 | $this->add_render_attribute( 'container', 'class', 'premium-cf7-container' ); |
| 612 | |
| 613 | ?> |
| 614 | |
| 615 | <div <?php echo $this->get_render_attribute_string( 'container' ); ?>> |
| 616 | <?php echo do_shortcode( '[contact-form-7 id="' . $settings['premium_wpcf7_form'] . '" ]' ); ?> |
| 617 | </div> |
| 618 | |
| 619 | <?php |
| 620 | } |
| 621 | |
| 622 | } |
| 623 | } |