theme-elements
6 years ago
accordion.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
carousel-navigation.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
gallery.php
6 years ago
gmap.php
6 years ago
heading-modern.php
6 years ago
icon.php
6 years ago
image.php
6 years ago
mailchimp.php
6 years ago
modern-button.php
6 years ago
quote.php
6 years ago
recent-comments.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-products.php
6 years ago
responsive-table.php
6 years ago
search.php
6 years ago
staff.php
6 years ago
svg.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
mailchimp.php
808 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Group_Control_Background; |
| 9 | use Elementor\Group_Control_Box_Shadow; |
| 10 | use Elementor\Scheme_Typography; |
| 11 | use Elementor\Group_Control_Border; |
| 12 | |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // Exit if accessed directly. |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Elementor 'MailChimp' widget. |
| 20 | * |
| 21 | * Elementor widget that displays an 'MailChimp' with lightbox. |
| 22 | * |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | class MailChimp extends Widget_Base { |
| 26 | |
| 27 | /** |
| 28 | * Get widget name. |
| 29 | * |
| 30 | * Retrieve 'MailChimp' widget name. |
| 31 | * |
| 32 | * @since 1.0.0 |
| 33 | * @access public |
| 34 | * |
| 35 | * @return string Widget name. |
| 36 | */ |
| 37 | public function get_name() { |
| 38 | return 'aux_mailchimp'; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get widget title. |
| 43 | * |
| 44 | * Retrieve 'MailChimp' widget title. |
| 45 | * |
| 46 | * @since 1.0.0 |
| 47 | * @access public |
| 48 | * |
| 49 | * @return string Widget title. |
| 50 | */ |
| 51 | public function get_title() { |
| 52 | return __('MailChimp', 'auxin-elements' ); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get widget icon. |
| 57 | * |
| 58 | * Retrieve 'MailChimp' widget icon. |
| 59 | * |
| 60 | * @since 1.0.0 |
| 61 | * @access public |
| 62 | * |
| 63 | * @return string Widget icon. |
| 64 | */ |
| 65 | public function get_icon() { |
| 66 | return 'eicon-mailchimp auxin-badge'; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get forms list. |
| 71 | * |
| 72 | * Retrieve 'MailChimp' widget icon. |
| 73 | * |
| 74 | * @since 1.0.0 |
| 75 | * @access public |
| 76 | * |
| 77 | * @return string Widget icon. |
| 78 | */ |
| 79 | public function get_forms() { |
| 80 | $options = array( 0 => __('Select the form to show', 'auxin-elements' ) ) ; |
| 81 | |
| 82 | if( ! function_exists('mc4wp_get_forms') ){ |
| 83 | return $options; |
| 84 | } |
| 85 | |
| 86 | $forms = mc4wp_get_forms(); |
| 87 | foreach( $forms as $form ) { |
| 88 | $options[ $form->ID ] = $form->name; |
| 89 | } |
| 90 | |
| 91 | return $options; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Get widget categories. |
| 96 | * |
| 97 | * Retrieve 'MailChimp' widget icon. |
| 98 | * |
| 99 | * @since 1.0.0 |
| 100 | * @access public |
| 101 | * |
| 102 | * @return string Widget icon. |
| 103 | */ |
| 104 | public function get_categories() { |
| 105 | return array( 'auxin-core' ); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Register 'MailChimp' widget controls. |
| 110 | * |
| 111 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 112 | * |
| 113 | * @since 1.0.0 |
| 114 | * @access protected |
| 115 | */ |
| 116 | protected function _register_controls() { |
| 117 | |
| 118 | /*-----------------------------------------------------------------------------------*/ |
| 119 | /* Content TAB |
| 120 | /*-----------------------------------------------------------------------------------*/ |
| 121 | |
| 122 | $this->start_controls_section( |
| 123 | 'forms_section', |
| 124 | [ |
| 125 | 'label' => __('Form', 'auxin-elements' ), |
| 126 | ] |
| 127 | ); |
| 128 | |
| 129 | $this->add_control( |
| 130 | 'form_type', |
| 131 | [ |
| 132 | 'label' => __( 'Form Type', 'auxin-elements' ), |
| 133 | 'type' => Controls_Manager::SELECT, |
| 134 | 'default' => 'default', |
| 135 | 'options' => [ |
| 136 | 'default' => __( 'Defaults' , 'auxin-elements' ), |
| 137 | 'custom' => __( 'Custom' , 'auxin-elements' ) |
| 138 | ] |
| 139 | ] |
| 140 | ); |
| 141 | |
| 142 | $this->add_control( |
| 143 | 'form_id', |
| 144 | [ |
| 145 | 'label' => __( 'MailChimp Sign-Up Form', 'auxin-elements' ), |
| 146 | 'label_block' => true, |
| 147 | 'type' => Controls_Manager::SELECT, |
| 148 | 'default' => 0, |
| 149 | 'options' => $this->get_forms(), |
| 150 | 'condition' => [ |
| 151 | 'form_type' => ['default'] |
| 152 | ] |
| 153 | ] |
| 154 | ); |
| 155 | |
| 156 | $this->add_control( |
| 157 | 'html', |
| 158 | [ |
| 159 | 'label' => __( 'Custom Form', 'auxin-elements' ), |
| 160 | 'type' => Controls_Manager::CODE, |
| 161 | 'language' => 'html', |
| 162 | 'description' => __( 'Enter your custom form markup', 'auxin-elements' ), |
| 163 | 'condition' => [ |
| 164 | 'form_type' => ['custom'] |
| 165 | ] |
| 166 | ] |
| 167 | ); |
| 168 | |
| 169 | $this->end_controls_section(); |
| 170 | |
| 171 | /*-----------------------------------------------------------------------------------*/ |
| 172 | /* Style TAB |
| 173 | /*-----------------------------------------------------------------------------------*/ |
| 174 | |
| 175 | $this->start_controls_section( |
| 176 | 'text_input_section', |
| 177 | [ |
| 178 | 'label' => __('Input', 'auxin-elements' ), |
| 179 | 'tab' => Controls_Manager::TAB_STYLE, |
| 180 | ] |
| 181 | ); |
| 182 | |
| 183 | $this->add_group_control( |
| 184 | Group_Control_Typography::get_type(), |
| 185 | [ |
| 186 | 'name' => 'input_typography', |
| 187 | 'label' => __( 'Typography', 'auxin-elements' ), |
| 188 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 189 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]', |
| 190 | ] |
| 191 | ); |
| 192 | |
| 193 | $this->add_control( |
| 194 | 'input_color', |
| 195 | [ |
| 196 | 'label' => __( 'Color', 'auxin-elements' ), |
| 197 | 'type' => Controls_Manager::COLOR, |
| 198 | 'selectors' => [ |
| 199 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'color: {{VALUE}};', |
| 200 | ] |
| 201 | ] |
| 202 | ); |
| 203 | |
| 204 | $this->add_responsive_control( |
| 205 | 'text_input_width', |
| 206 | [ |
| 207 | 'label' => __( 'Width', 'auxin-elements' ), |
| 208 | 'size_units' => [ 'px','em', '%'], |
| 209 | 'type' => Controls_Manager::SLIDER, |
| 210 | 'range' => [ |
| 211 | 'px' => [ |
| 212 | 'min' => 0, |
| 213 | 'max' => 1000, |
| 214 | 'step' => 5, |
| 215 | ], |
| 216 | '%' => [ |
| 217 | 'min' => 0, |
| 218 | 'max' => 100, |
| 219 | ], |
| 220 | 'em' => [ |
| 221 | 'min' => 0, |
| 222 | 'max' => 100, |
| 223 | ], |
| 224 | ], |
| 225 | 'selectors' => [ |
| 226 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'width: {{SIZE}}{{UNIT}};', |
| 227 | ], |
| 228 | ] |
| 229 | ); |
| 230 | |
| 231 | $this->add_responsive_control( |
| 232 | 'text_input_max_width', |
| 233 | [ |
| 234 | 'label' => __( 'Max Width', 'auxin-elements' ), |
| 235 | 'size_units' => [ 'px','em', '%'], |
| 236 | 'type' => Controls_Manager::SLIDER, |
| 237 | 'range' => [ |
| 238 | 'px' => [ |
| 239 | 'min' => 0, |
| 240 | 'max' => 1000, |
| 241 | 'step' => 5 |
| 242 | ], |
| 243 | '%' => [ |
| 244 | 'min' => 0, |
| 245 | 'max' => 100 |
| 246 | ], |
| 247 | 'em' => [ |
| 248 | 'min' => 0, |
| 249 | 'max' => 100 |
| 250 | ] |
| 251 | ], |
| 252 | 'selectors' => [ |
| 253 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'max-width: {{SIZE}}{{UNIT}};', |
| 254 | ] |
| 255 | ] |
| 256 | ); |
| 257 | |
| 258 | $this->add_responsive_control( |
| 259 | 'text_input_height', |
| 260 | [ |
| 261 | 'label' => __( 'Height', 'auxin-elements' ), |
| 262 | 'size_units' => [ 'px', 'em'], |
| 263 | 'type' => Controls_Manager::SLIDER, |
| 264 | 'range' => [ |
| 265 | 'px' => [ |
| 266 | 'min' => 0, |
| 267 | 'max' => 1000, |
| 268 | 'step' => 5 |
| 269 | ], |
| 270 | '%' => [ |
| 271 | 'min' => 0, |
| 272 | 'max' => 100 |
| 273 | ], |
| 274 | 'em' => [ |
| 275 | 'min' => 0, |
| 276 | 'max' => 100 |
| 277 | ] |
| 278 | ], |
| 279 | 'selectors' => [ |
| 280 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'height: {{SIZE}}{{UNIT}};', |
| 281 | ], |
| 282 | 'separator' => 'after' |
| 283 | ] |
| 284 | ); |
| 285 | |
| 286 | |
| 287 | $this->add_group_control( |
| 288 | Group_Control_Border::get_type(), |
| 289 | [ |
| 290 | 'name' => 'input_border', |
| 291 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' |
| 292 | ] |
| 293 | ); |
| 294 | |
| 295 | $this->add_responsive_control( |
| 296 | 'input_border_radius', |
| 297 | [ |
| 298 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 299 | 'type' => Controls_Manager::DIMENSIONS, |
| 300 | 'size_units' => [ 'px', '%' ], |
| 301 | 'selectors' => [ |
| 302 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 303 | ], |
| 304 | ] |
| 305 | ); |
| 306 | |
| 307 | $this->add_responsive_control( |
| 308 | 'input_padding', |
| 309 | [ |
| 310 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 311 | 'type' => Controls_Manager::DIMENSIONS, |
| 312 | 'size_units' => [ 'px', '%', 'em' ], |
| 313 | 'selectors' => [ |
| 314 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 315 | ], |
| 316 | 'separator' => 'after' |
| 317 | ] |
| 318 | ); |
| 319 | |
| 320 | // Background and Box Shadow for input - START |
| 321 | $this->start_controls_tabs( 'input_tabs' ); |
| 322 | |
| 323 | $this->start_controls_tab( |
| 324 | 'input_tab_normal_state', |
| 325 | [ |
| 326 | 'label' => __( 'Normal', 'auxin-elements' ), |
| 327 | ] |
| 328 | ); |
| 329 | |
| 330 | $this->add_group_control( |
| 331 | Group_Control_Background::get_type(), |
| 332 | [ |
| 333 | 'name' => 'input_background', |
| 334 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"], {{WRAPPER}} .mc4wp-form input[type="email"]', |
| 335 | 'types' => [ 'classic', 'gradient'] |
| 336 | ] |
| 337 | ); |
| 338 | |
| 339 | $this->add_group_control( |
| 340 | Group_Control_Box_Shadow::get_type(), |
| 341 | [ |
| 342 | 'name' => 'input_box_shadow', |
| 343 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"], {{WRAPPER}} .mc4wp-form input[type="email"]' |
| 344 | ] |
| 345 | ); |
| 346 | |
| 347 | $this->end_controls_tab(); |
| 348 | |
| 349 | $this->start_controls_tab( |
| 350 | 'input_tab_hover_state', |
| 351 | [ |
| 352 | 'label' => __( 'Hover', 'auxin-elements' ), |
| 353 | ] |
| 354 | ); |
| 355 | |
| 356 | $this->add_group_control( |
| 357 | Group_Control_Background::get_type(), |
| 358 | [ |
| 359 | 'name' => 'input_background_hover', |
| 360 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"]:hover, {{WRAPPER}} .mc4wp-form input[type="email"]:hover', |
| 361 | 'types' => [ 'classic', 'gradient'] |
| 362 | ] |
| 363 | ); |
| 364 | |
| 365 | $this->add_group_control( |
| 366 | Group_Control_Box_Shadow::get_type(), |
| 367 | [ |
| 368 | 'name' => 'input_box_shadow_hover', |
| 369 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"]:hover,{{WRAPPER}} .mc4wp-form input[type="email"]:hover' |
| 370 | ] |
| 371 | ); |
| 372 | |
| 373 | $this->add_control( |
| 374 | 'input_transition', |
| 375 | [ |
| 376 | 'label' => __( 'Transition Duration', 'auxin-elements' ), |
| 377 | 'type' => Controls_Manager::SLIDER, |
| 378 | 'default' => [ |
| 379 | 'size' => 0.3, |
| 380 | ], |
| 381 | 'range' => [ |
| 382 | 'px' => [ |
| 383 | 'max' => 3, |
| 384 | 'step' => 0.1, |
| 385 | ], |
| 386 | ], |
| 387 | 'render_type' => 'ui', |
| 388 | 'selectors' => [ |
| 389 | '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => "transition:all ease-out {{SIZE}}s;" |
| 390 | ] |
| 391 | ] |
| 392 | ); |
| 393 | |
| 394 | $this->end_controls_tab(); |
| 395 | |
| 396 | $this->end_controls_tabs(); |
| 397 | // Background and Box Shadow for input - END |
| 398 | |
| 399 | |
| 400 | $this->end_controls_section(); |
| 401 | |
| 402 | $this->start_controls_section( |
| 403 | 'placeholder_section', |
| 404 | [ |
| 405 | 'label' => __('Input Placeholder Text', 'auxin-elements' ), |
| 406 | 'tab' => Controls_Manager::TAB_STYLE |
| 407 | ] |
| 408 | ); |
| 409 | |
| 410 | $this->add_group_control( |
| 411 | Group_Control_Typography::get_type(), |
| 412 | [ |
| 413 | 'name' => 'placeholder_typography', |
| 414 | 'label' => __( 'Typography', 'auxin-elements' ), |
| 415 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 416 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"]::placeholder,{{WRAPPER}} .mc4wp-form input[type="email"]::placeholder' |
| 417 | ] |
| 418 | ); |
| 419 | |
| 420 | $this->add_control( |
| 421 | 'placeholder_color', |
| 422 | [ |
| 423 | 'label' => __( 'Color', 'auxin-elements' ), |
| 424 | 'type' => Controls_Manager::COLOR, |
| 425 | 'selectors' => [ |
| 426 | '{{WRAPPER}} .mc4wp-form input[type="text"]::placeholder,{{WRAPPER}} .mc4wp-form input[type="email"]::placeholder' => 'color: {{VALUE}};', |
| 427 | ] |
| 428 | ] |
| 429 | ); |
| 430 | |
| 431 | $this->end_controls_section(); |
| 432 | |
| 433 | $this->start_controls_section( |
| 434 | 'submit_input_section', |
| 435 | [ |
| 436 | 'label' => __('Subscribe Button', 'auxin-elements' ), |
| 437 | 'tab' => Controls_Manager::TAB_STYLE, |
| 438 | ] |
| 439 | ); |
| 440 | |
| 441 | $this->add_group_control( |
| 442 | Group_Control_Typography::get_type(), |
| 443 | [ |
| 444 | 'name' => 'submit_input_typography', |
| 445 | 'label' => __( 'Typography', 'auxin-elements' ), |
| 446 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 447 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]', |
| 448 | ] |
| 449 | ); |
| 450 | |
| 451 | $this->add_responsive_control( |
| 452 | 'submit_input_width', |
| 453 | [ |
| 454 | 'label' => __( 'Width', 'auxin-elements' ), |
| 455 | 'size_units' => [ 'px','em', '%'], |
| 456 | 'type' => Controls_Manager::SLIDER, |
| 457 | 'range' => [ |
| 458 | 'px' => [ |
| 459 | 'min' => 0, |
| 460 | 'max' => 1000, |
| 461 | 'step' => 5, |
| 462 | ], |
| 463 | '%' => [ |
| 464 | 'min' => 0, |
| 465 | 'max' => 100, |
| 466 | ], |
| 467 | 'em' => [ |
| 468 | 'min' => 0, |
| 469 | 'max' => 100, |
| 470 | ], |
| 471 | ], |
| 472 | 'selectors' => [ |
| 473 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'width: {{SIZE}}{{UNIT}};', |
| 474 | ], |
| 475 | ] |
| 476 | ); |
| 477 | |
| 478 | $this->add_responsive_control( |
| 479 | 'submit_input_max_width', |
| 480 | [ |
| 481 | 'label' => __( 'Max Width', 'auxin-elements' ), |
| 482 | 'size_units' => [ 'px','em', '%'], |
| 483 | 'type' => Controls_Manager::SLIDER, |
| 484 | 'range' => [ |
| 485 | 'px' => [ |
| 486 | 'min' => 0, |
| 487 | 'max' => 1000, |
| 488 | 'step' => 5, |
| 489 | ], |
| 490 | '%' => [ |
| 491 | 'min' => 0, |
| 492 | 'max' => 100, |
| 493 | ], |
| 494 | 'em' => [ |
| 495 | 'min' => 0, |
| 496 | 'max' => 100, |
| 497 | ], |
| 498 | ], |
| 499 | 'selectors' => [ |
| 500 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'max-width: {{SIZE}}{{UNIT}};', |
| 501 | ], |
| 502 | ] |
| 503 | ); |
| 504 | |
| 505 | $this->add_responsive_control( |
| 506 | 'submit_input_height', |
| 507 | [ |
| 508 | 'label' => __( 'Height', 'auxin-elements' ), |
| 509 | 'size_units' => [ 'px', 'em'], |
| 510 | 'type' => Controls_Manager::SLIDER, |
| 511 | 'range' => [ |
| 512 | 'px' => [ |
| 513 | 'min' => 0, |
| 514 | 'max' => 1000, |
| 515 | 'step' => 5 |
| 516 | ], |
| 517 | '%' => [ |
| 518 | 'min' => 0, |
| 519 | 'max' => 100 |
| 520 | ], |
| 521 | 'em' => [ |
| 522 | 'min' => 0, |
| 523 | 'max' => 100 |
| 524 | ] |
| 525 | ], |
| 526 | 'selectors' => [ |
| 527 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'height: {{SIZE}}{{UNIT}};' |
| 528 | ], |
| 529 | 'separator' => 'after' |
| 530 | ] |
| 531 | ); |
| 532 | |
| 533 | $this->add_group_control( |
| 534 | Group_Control_Border::get_type(), |
| 535 | [ |
| 536 | 'name' => 'submit_border', |
| 537 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]' |
| 538 | ] |
| 539 | ); |
| 540 | |
| 541 | $this->add_responsive_control( |
| 542 | 'submit_border_radius', |
| 543 | [ |
| 544 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 545 | 'type' => Controls_Manager::DIMENSIONS, |
| 546 | 'size_units' => [ 'px', '%' ], |
| 547 | 'selectors' => [ |
| 548 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 549 | ], |
| 550 | ] |
| 551 | ); |
| 552 | |
| 553 | $this->add_responsive_control( |
| 554 | 'submit_input_padding', |
| 555 | [ |
| 556 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 557 | 'type' => Controls_Manager::DIMENSIONS, |
| 558 | 'size_units' => [ 'px', '%', 'em' ], |
| 559 | 'selectors' => [ |
| 560 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT};' |
| 561 | ] |
| 562 | ] |
| 563 | ); |
| 564 | |
| 565 | // Background and box shadow Options for submit button - START |
| 566 | $this->start_controls_tabs( 'submit_tabs' ); |
| 567 | |
| 568 | $this->start_controls_tab( |
| 569 | 'submit_input_tab_normal_state', |
| 570 | [ |
| 571 | 'label' => __( 'Normal', 'auxin-elements' ), |
| 572 | ] |
| 573 | ); |
| 574 | |
| 575 | $this->add_control( |
| 576 | 'submit_input_color_normal', |
| 577 | [ |
| 578 | 'label' => __( 'Color', 'auxin-elements' ), |
| 579 | 'type' => Controls_Manager::COLOR, |
| 580 | 'selectors' => [ |
| 581 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'color: {{VALUE}};', |
| 582 | ], |
| 583 | ] |
| 584 | ); |
| 585 | |
| 586 | $this->add_group_control( |
| 587 | Group_Control_Background::get_type(), |
| 588 | [ |
| 589 | 'name' => 'submit_input_background', |
| 590 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]', |
| 591 | 'types' => [ 'classic', 'gradient'], |
| 592 | ] |
| 593 | ); |
| 594 | |
| 595 | $this->add_group_control( |
| 596 | Group_Control_Box_Shadow::get_type(), |
| 597 | [ |
| 598 | 'name' => 'sbumit_input_box_shadow', |
| 599 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]' |
| 600 | ] |
| 601 | ); |
| 602 | |
| 603 | |
| 604 | $this->end_controls_tab(); |
| 605 | |
| 606 | $this->start_controls_tab( |
| 607 | 'submit_input_tab_hover_state', |
| 608 | [ |
| 609 | 'label' => __( 'Hover', 'auxin-elements' ), |
| 610 | ] |
| 611 | ); |
| 612 | |
| 613 | $this->add_control( |
| 614 | 'submit_input_color_hover', |
| 615 | [ |
| 616 | 'label' => __( 'Color', 'auxin-elements' ), |
| 617 | 'type' => Controls_Manager::COLOR, |
| 618 | 'selectors' => [ |
| 619 | '{{WRAPPER}} .mc4wp-form input[type="submit"]:hover' => 'color: {{VALUE}};', |
| 620 | ], |
| 621 | ] |
| 622 | ); |
| 623 | |
| 624 | $this->add_group_control( |
| 625 | Group_Control_Background::get_type(), |
| 626 | [ |
| 627 | 'name' => 'submit_input_background_hover', |
| 628 | 'types' => [ 'classic', 'gradient'], |
| 629 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]:hover', |
| 630 | ] |
| 631 | ); |
| 632 | |
| 633 | $this->add_group_control( |
| 634 | Group_Control_Box_Shadow::get_type(), |
| 635 | [ |
| 636 | 'name' => 'sbumit_input_box_shadow_hover', |
| 637 | 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]:hover' |
| 638 | ] |
| 639 | ); |
| 640 | |
| 641 | $this->add_control( |
| 642 | 'submit_input_hover_transition', |
| 643 | [ |
| 644 | 'label' => __( 'Transition Duration', 'auxin-elements' ), |
| 645 | 'type' => Controls_Manager::SLIDER, |
| 646 | 'default' => [ |
| 647 | 'size' => 0.3, |
| 648 | ], |
| 649 | 'range' => [ |
| 650 | 'px' => [ |
| 651 | 'max' => 3, |
| 652 | 'step' => 0.1, |
| 653 | ], |
| 654 | ], |
| 655 | 'render_type' => 'ui', |
| 656 | 'selectors' => [ |
| 657 | '{{WRAPPER}} .mc4wp-form input[type="submit"]' => "transition: all ease-out {{SIZE}}s;" |
| 658 | ] |
| 659 | ] |
| 660 | ); |
| 661 | |
| 662 | $this->end_controls_tab(); |
| 663 | |
| 664 | $this->end_controls_tabs(); |
| 665 | // Background and box shadow Options for submit button - END |
| 666 | |
| 667 | |
| 668 | $this->end_controls_section(); |
| 669 | |
| 670 | |
| 671 | $this->start_controls_section( |
| 672 | 'form_container_section', |
| 673 | [ |
| 674 | 'label' => __('Form Container', 'auxin-elements' ), |
| 675 | 'tab' => Controls_Manager::TAB_STYLE |
| 676 | ] |
| 677 | ); |
| 678 | |
| 679 | $this->add_responsive_control( |
| 680 | 'form_container_width', |
| 681 | [ |
| 682 | 'label' => __( 'Width', 'auxin-elements' ), |
| 683 | 'size_units' => [ 'px','em', '%'], |
| 684 | 'type' => Controls_Manager::SLIDER, |
| 685 | 'range' => [ |
| 686 | 'px' => [ |
| 687 | 'min' => 0, |
| 688 | 'max' => 1000, |
| 689 | 'step' => 5 |
| 690 | ], |
| 691 | '%' => [ |
| 692 | 'min' => 0, |
| 693 | 'max' => 100 |
| 694 | ], |
| 695 | 'em' => [ |
| 696 | 'min' => 0, |
| 697 | 'max' => 100 |
| 698 | ], |
| 699 | ], |
| 700 | 'selectors' => [ |
| 701 | '{{WRAPPER}} .mc4wp-form-fields' => 'width: {{SIZE}}{{UNIT}};' |
| 702 | ] |
| 703 | ] |
| 704 | ); |
| 705 | |
| 706 | $this->add_responsive_control( |
| 707 | 'form_container_max_width', |
| 708 | [ |
| 709 | 'label' => __( 'Max Width', 'auxin-elements' ), |
| 710 | 'size_units' => [ 'px','em', '%'], |
| 711 | 'type' => Controls_Manager::SLIDER, |
| 712 | 'range' => [ |
| 713 | 'px' => [ |
| 714 | 'min' => 0, |
| 715 | 'max' => 1000, |
| 716 | 'step' => 5 |
| 717 | ], |
| 718 | '%' => [ |
| 719 | 'min' => 0, |
| 720 | 'max' => 100 |
| 721 | ], |
| 722 | 'em' => [ |
| 723 | 'min' => 0, |
| 724 | 'max' => 100 |
| 725 | ], |
| 726 | ], |
| 727 | 'selectors' => [ |
| 728 | '{{WRAPPER}} .mc4wp-form-fields' => 'max-width: {{SIZE}}{{UNIT}};' |
| 729 | ] |
| 730 | ] |
| 731 | ); |
| 732 | |
| 733 | $this->add_responsive_control( |
| 734 | 'form_container_height', |
| 735 | [ |
| 736 | 'label' => __( 'Height', 'auxin-elements' ), |
| 737 | 'size_units' => [ 'px', 'em'], |
| 738 | 'type' => Controls_Manager::SLIDER, |
| 739 | 'range' => [ |
| 740 | 'px' => [ |
| 741 | 'min' => 0, |
| 742 | 'max' => 1000, |
| 743 | 'step' => 5 |
| 744 | ], |
| 745 | '%' => [ |
| 746 | 'min' => 0, |
| 747 | 'max' => 100 |
| 748 | ], |
| 749 | 'em' => [ |
| 750 | 'min' => 0, |
| 751 | 'max' => 100 |
| 752 | ] |
| 753 | ], |
| 754 | 'selectors' => [ |
| 755 | '{{WRAPPER}} .mc4wp-form-fields' => 'height: {{SIZE}}{{UNIT}};' |
| 756 | ] |
| 757 | ] |
| 758 | ); |
| 759 | |
| 760 | $this->end_controls_section(); |
| 761 | } |
| 762 | |
| 763 | /** |
| 764 | * Render mailchimp custom form markup |
| 765 | * |
| 766 | * |
| 767 | * @since 1.0.0 |
| 768 | * @access protected |
| 769 | */ |
| 770 | public function custom_form( $content ) { |
| 771 | $settings = $this->get_settings_for_display(); |
| 772 | |
| 773 | if( ! empty( $settings['html'] ) ) { |
| 774 | $content = $settings['html']; |
| 775 | } |
| 776 | |
| 777 | return $content; |
| 778 | } |
| 779 | |
| 780 | /** |
| 781 | * Render mailchimp widget output on the frontend. |
| 782 | * |
| 783 | * Written in PHP and used to generate the final HTML. |
| 784 | * |
| 785 | * @since 1.0.0 |
| 786 | * @access protected |
| 787 | */ |
| 788 | protected function render() { |
| 789 | // Check whether required resources are available |
| 790 | if( ! function_exists('mc4wp_show_form') ) { |
| 791 | auxin_elementor_plugin_missing_notice( array( 'plugin_name' => __( 'MailChimp', 'auxin-elements' ) ) ); |
| 792 | return; |
| 793 | } |
| 794 | |
| 795 | $settings = $this->get_settings_for_display(); |
| 796 | |
| 797 | if( $settings['form_type'] === 'custom' ) { |
| 798 | add_filter( 'mc4wp_form_content', array( $this, 'custom_form'), 10, 1 ); |
| 799 | $settings['form_id'] = 0; |
| 800 | } elseif( get_post_type( $settings['form_id'] ) !== 'mc4wp-form' ){ |
| 801 | $settings['form_id'] = 0; |
| 802 | } |
| 803 | |
| 804 | return mc4wp_show_form( $settings['form_id'] ); |
| 805 | } |
| 806 | |
| 807 | } |
| 808 |