contact-form7.php
889 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use \Elementor\ElementsKit_Widget_Contact_Form7_Handler as Handler; |
| 5 | |
| 6 | if (! defined( 'ABSPATH' ) ) exit; |
| 7 | |
| 8 | class ElementsKit_Widget_Contact_Form7 extends Widget_Base { |
| 9 | use \ElementsKit_Lite\Widgets\Widget_Notice; |
| 10 | |
| 11 | public $base; |
| 12 | |
| 13 | public function get_name() { |
| 14 | return Handler::get_name(); |
| 15 | } |
| 16 | |
| 17 | public function get_title() { |
| 18 | return Handler::get_title(); |
| 19 | } |
| 20 | |
| 21 | public function get_icon() { |
| 22 | return Handler::get_icon(); |
| 23 | } |
| 24 | |
| 25 | public function get_categories() { |
| 26 | return Handler::get_categories(); |
| 27 | } |
| 28 | |
| 29 | public function get_keywords() { |
| 30 | return Handler::get_keywords(); |
| 31 | } |
| 32 | |
| 33 | public function get_help_url() { |
| 34 | return 'https://wpmet.com/doc/contact-form-7/'; |
| 35 | } |
| 36 | |
| 37 | protected function is_dynamic_content(): bool { |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | public function has_widget_inner_wrapper(): bool { |
| 42 | return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 43 | } |
| 44 | |
| 45 | function ekit_cf7form() { |
| 46 | $wpcf7_form_list = get_posts( array( |
| 47 | 'post_type' => 'wpcf7_contact_form', |
| 48 | 'showposts' => 999, |
| 49 | ) ); |
| 50 | $posts = array(); |
| 51 | if ( !empty( $wpcf7_form_list ) && !is_wp_error( $wpcf7_form_list ) ) { |
| 52 | foreach ( $wpcf7_form_list as $post ) { |
| 53 | $options[ $post->ID ] = $post->post_title; |
| 54 | } |
| 55 | return $options; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | protected function register_controls() { |
| 60 | $this->start_controls_section( |
| 61 | 'section_tab', [ |
| 62 | 'label' =>esc_html__( 'Contact Form 7', 'elementskit-lite' ), |
| 63 | ] |
| 64 | ); |
| 65 | |
| 66 | |
| 67 | |
| 68 | $this->add_control( |
| 69 | 'ekit_contact_form7', |
| 70 | [ |
| 71 | 'label' =>esc_html__( 'Style', 'elementskit-lite' ), |
| 72 | 'type' => Controls_Manager::SELECT, |
| 73 | 'default' => 'accoedion-primary', |
| 74 | 'options' => $this->ekit_cf7form() |
| 75 | ] |
| 76 | ); |
| 77 | |
| 78 | $this->end_controls_section(); |
| 79 | |
| 80 | // label |
| 81 | $this->start_controls_section( |
| 82 | 'ekit_contact_form_input_label_style', |
| 83 | [ |
| 84 | 'label' => esc_html__( 'Label', 'elementskit-lite' ), |
| 85 | 'tab' => Controls_Manager::TAB_STYLE, |
| 86 | ] |
| 87 | ); |
| 88 | |
| 89 | $this->add_group_control( |
| 90 | Group_Control_Typography::get_type(), |
| 91 | [ |
| 92 | 'name' => 'ekit_contact_form_input_label_typography', |
| 93 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 94 | 'selector' => '{{WRAPPER}} .ekit-form form label', |
| 95 | ] |
| 96 | ); |
| 97 | |
| 98 | $this->add_responsive_control( |
| 99 | 'ekit_contact_form_input_label_color', |
| 100 | [ |
| 101 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 102 | 'type' => Controls_Manager::COLOR, |
| 103 | 'default' => '#000000', |
| 104 | 'selectors' => [ |
| 105 | '{{WRAPPER}} .ekit-form form label' => 'color: {{VALUE}}', |
| 106 | ], |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $this->add_responsive_control( |
| 111 | 'ekit_contact_form_input_label_margin', |
| 112 | [ |
| 113 | 'label' => esc_html__( 'Margin', 'elementskit-lite' ), |
| 114 | 'type' => Controls_Manager::DIMENSIONS, |
| 115 | 'size_units' => [ 'px', '%', 'em' ], |
| 116 | 'selectors' => [ |
| 117 | '{{WRAPPER}} .ekit-form form label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 118 | ], |
| 119 | ] |
| 120 | ); |
| 121 | |
| 122 | $this->add_control( |
| 123 | 'ekit_contact_form_input_label_hint_heading', |
| 124 | [ |
| 125 | 'label' => esc_html__( 'Hint', 'elementskit-lite' ), |
| 126 | 'type' => Controls_Manager::HEADING, |
| 127 | 'separator' => 'before', |
| 128 | ] |
| 129 | ); |
| 130 | |
| 131 | $this->add_group_control( |
| 132 | Group_Control_Typography::get_type(), |
| 133 | [ |
| 134 | 'name' => 'ekit_contact_form_input_label_hint_typography', |
| 135 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 136 | 'selector' => '{{WRAPPER}} .ekit-form form label span', |
| 137 | ] |
| 138 | ); |
| 139 | |
| 140 | $this->add_responsive_control( |
| 141 | 'ekit_contact_form_input_label_hint_color', |
| 142 | [ |
| 143 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 144 | 'type' => Controls_Manager::COLOR, |
| 145 | 'default' => '#777777', |
| 146 | 'selectors' => [ |
| 147 | '{{WRAPPER}} .ekit-form form label span' => 'color: {{VALUE}}', |
| 148 | ], |
| 149 | ] |
| 150 | ); |
| 151 | |
| 152 | $this->end_controls_section(); |
| 153 | |
| 154 | // input style |
| 155 | $this->start_controls_section( |
| 156 | 'ekit_contact_form_input_style', |
| 157 | [ |
| 158 | 'label' => esc_html__( 'Input', 'elementskit-lite' ), |
| 159 | 'tab' => Controls_Manager::TAB_STYLE, |
| 160 | ] |
| 161 | ); |
| 162 | |
| 163 | $this->add_responsive_control( |
| 164 | 'ekit_contact_form_input_style_padding', |
| 165 | [ |
| 166 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 167 | 'type' => Controls_Manager::DIMENSIONS, |
| 168 | 'size_units' => [ 'px', '%', 'em' ], |
| 169 | 'selectors' => [ |
| 170 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .ekit-form form select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 171 | ], |
| 172 | ] |
| 173 | ); |
| 174 | |
| 175 | $this->add_responsive_control( |
| 176 | 'ekit_contact_form_input_style_width', |
| 177 | [ |
| 178 | 'label' => esc_html__( 'Width', 'elementskit-lite' ), |
| 179 | 'type' => Controls_Manager::SLIDER, |
| 180 | 'size_units' => [ 'px', '%' ], |
| 181 | 'range' => [ |
| 182 | 'px' => [ |
| 183 | 'min' => 0, |
| 184 | 'max' => 1000, |
| 185 | 'step' => 5, |
| 186 | ], |
| 187 | '%' => [ |
| 188 | 'min' => 0, |
| 189 | 'max' => 100, |
| 190 | ], |
| 191 | ], |
| 192 | 'default' => [ |
| 193 | 'unit' => '%', |
| 194 | 'size' => 100, |
| 195 | ], |
| 196 | 'selectors' => [ |
| 197 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .ekit-form form select' => 'width: {{SIZE}}{{UNIT}};', |
| 198 | '{{WRAPPER}} .ekit-form form textarea' => 'width: {{SIZE}}{{UNIT}};', |
| 199 | ], |
| 200 | ] |
| 201 | ); |
| 202 | |
| 203 | $this->add_responsive_control( |
| 204 | 'ekit_contact_form_input_style_height', |
| 205 | [ |
| 206 | 'label' => esc_html__( 'Height', 'elementskit-lite' ), |
| 207 | 'type' => Controls_Manager::SLIDER, |
| 208 | 'size_units' => [ 'px' ], |
| 209 | 'range' => [ |
| 210 | 'px' => [ |
| 211 | 'min' => 0, |
| 212 | 'max' => 200, |
| 213 | 'step' => 1, |
| 214 | ], |
| 215 | ], |
| 216 | 'default' => [ |
| 217 | 'unit' => 'px', |
| 218 | 'size' => 50, |
| 219 | ], |
| 220 | 'selectors' => [ |
| 221 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .ekit-form form select' => 'height: {{SIZE}}px;', |
| 222 | '{{WRAPPER}} .ekit-form form textarea' => 'height: {{SIZE}}px;', |
| 223 | ], |
| 224 | ] |
| 225 | ); |
| 226 | |
| 227 | $this->add_responsive_control( |
| 228 | 'ekit_contact_form_input_style_margin_bottom', |
| 229 | [ |
| 230 | 'label' => esc_html__( 'Margin Bottom', 'elementskit-lite' ), |
| 231 | 'type' => Controls_Manager::SLIDER, |
| 232 | 'size_units' => [ 'px' ], |
| 233 | 'range' => [ |
| 234 | 'px' => [ |
| 235 | 'min' => 0, |
| 236 | 'max' => 100, |
| 237 | 'step' => 1, |
| 238 | ], |
| 239 | ], |
| 240 | 'default' => [ |
| 241 | 'unit' => 'px', |
| 242 | 'size' => 20, |
| 243 | ], |
| 244 | 'selectors' => [ |
| 245 | '{{WRAPPER}} .ekit-form form .ekit-form-input, {{WRAPPER}} .ekit-form form select, {{WRAPPER}} .ekit-form form input' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 246 | '{{WRAPPER}} .ekit-form form textarea' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 247 | ], |
| 248 | ] |
| 249 | ); |
| 250 | |
| 251 | $this->add_control( |
| 252 | 'ekit_contact_form_input_style_textarea_heading', |
| 253 | [ |
| 254 | 'label' => esc_html__( 'Textarea', 'elementskit-lite' ), |
| 255 | 'type' => Controls_Manager::HEADING, |
| 256 | 'separator' => 'before', |
| 257 | ] |
| 258 | ); |
| 259 | |
| 260 | $this->add_responsive_control( |
| 261 | 'ekit_contact_form_input_style_textarea_height', |
| 262 | [ |
| 263 | 'label' => esc_html__( 'Height', 'elementskit-lite' ), |
| 264 | 'type' => Controls_Manager::SLIDER, |
| 265 | 'size_units' => [ 'px', '%' ], |
| 266 | 'range' => [ |
| 267 | 'px' => [ |
| 268 | 'min' => 176, |
| 269 | 'max' => 300, |
| 270 | 'step' => 1, |
| 271 | ], |
| 272 | '%' => [ |
| 273 | 'min' => 0, |
| 274 | 'max' => 100, |
| 275 | ], |
| 276 | ], |
| 277 | 'default' => [ |
| 278 | 'unit' => 'px', |
| 279 | 'size' => 176, |
| 280 | ], |
| 281 | 'selectors' => [ |
| 282 | '{{WRAPPER}} .ekit-form form textarea' => 'height: {{SIZE}}{{UNIT}};', |
| 283 | ], |
| 284 | ] |
| 285 | ); |
| 286 | |
| 287 | $this->add_responsive_control( |
| 288 | 'ekit_contact_form_input_style_padding_textarea', |
| 289 | [ |
| 290 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 291 | 'type' => Controls_Manager::DIMENSIONS, |
| 292 | 'size_units' => [ 'px', '%', 'em' ], |
| 293 | 'selectors' => [ |
| 294 | '{{WRAPPER}} .ekit-form form textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 295 | ], |
| 296 | ] |
| 297 | ); |
| 298 | |
| 299 | $this->add_control( |
| 300 | 'ekit_contact_form_input_style_padding_textarea_hr', |
| 301 | [ |
| 302 | 'type' => Controls_Manager::DIVIDER, |
| 303 | ] |
| 304 | ); |
| 305 | |
| 306 | $this->start_controls_tabs( |
| 307 | 'ekit_contact_form_input_normal_and_hover_tabs' |
| 308 | ); |
| 309 | $this->start_controls_tab( |
| 310 | 'ekit_contact_form_input_normal_tab', |
| 311 | [ |
| 312 | 'label' => esc_html__( 'Normal', 'elementskit-lite' ), |
| 313 | ] |
| 314 | ); |
| 315 | |
| 316 | $this->add_group_control( |
| 317 | Group_Control_Background::get_type(), |
| 318 | [ |
| 319 | 'name' => 'ekit_contact_form_input_style_background', |
| 320 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 321 | 'types' => [ 'classic', 'gradient' ], |
| 322 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]) ,{{WRAPPER}} .ekit-form form textarea, {{WRAPPER}} .ekit-form form select', |
| 323 | 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 324 | ] |
| 325 | ); |
| 326 | |
| 327 | $this->add_responsive_control( |
| 328 | 'ekit_contact_form_input_style_radius', |
| 329 | [ |
| 330 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 331 | 'type' => Controls_Manager::DIMENSIONS, |
| 332 | 'size_units' => [ 'px', '%' ], |
| 333 | 'selectors' => [ |
| 334 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .ekit-form form select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 335 | '{{WRAPPER}} .ekit-form form textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 336 | ], |
| 337 | ] |
| 338 | ); |
| 339 | |
| 340 | $this->add_group_control( |
| 341 | Group_Control_Border::get_type(), |
| 342 | [ |
| 343 | 'name' => 'ekit_contact_form_input_style_border', |
| 344 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 345 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .ekit-form form textarea, {{WRAPPER}} .ekit-form form select', |
| 346 | ] |
| 347 | ); |
| 348 | |
| 349 | $this->add_group_control( |
| 350 | Group_Control_Box_Shadow::get_type(), |
| 351 | [ |
| 352 | 'name' => 'ekit_contact_form_input_style_box_shadow', |
| 353 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 354 | 'selector' => ' |
| 355 | {{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), |
| 356 | {{WRAPPER}} .ekit-form form textarea, {{WRAPPER}} .ekit-form form select' |
| 357 | , |
| 358 | ] |
| 359 | ); |
| 360 | |
| 361 | $this->end_controls_tab(); |
| 362 | $this->start_controls_tab( |
| 363 | 'ekit_contact_form_input_hover_tab', |
| 364 | [ |
| 365 | 'label' => esc_html__( 'Hover', 'elementskit-lite' ), |
| 366 | ] |
| 367 | ); |
| 368 | |
| 369 | $this->add_group_control( |
| 370 | Group_Control_Background::get_type(), |
| 371 | [ |
| 372 | 'name' => 'ekit_contact_form_input_hover_style_background', |
| 373 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 374 | 'types' => [ 'classic', 'gradient' ], |
| 375 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):hover ,{{WRAPPER}} .ekit-form form textarea:hover, {{WRAPPER}} .ekit-form form select:hover', |
| 376 | 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 377 | ] |
| 378 | ); |
| 379 | |
| 380 | $this->add_responsive_control( |
| 381 | 'ekit_contact_form_input_hover_style_radius', |
| 382 | [ |
| 383 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 384 | 'type' => Controls_Manager::DIMENSIONS, |
| 385 | 'size_units' => [ 'px', '%' ], |
| 386 | 'selectors' => [ |
| 387 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):hover, {{WRAPPER}} .ekit-form form select:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 388 | '{{WRAPPER}} .ekit-form form textarea:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 389 | ], |
| 390 | ] |
| 391 | ); |
| 392 | |
| 393 | $this->add_group_control( |
| 394 | Group_Control_Border::get_type(), |
| 395 | [ |
| 396 | 'name' => 'ekit_contact_form_input_hover_style_border', |
| 397 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 398 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):hover, {{WRAPPER}} .ekit-form form textarea:hover, {{WRAPPER}} .ekit-form form select:hover', |
| 399 | ] |
| 400 | ); |
| 401 | |
| 402 | $this->add_group_control( |
| 403 | Group_Control_Box_Shadow::get_type(), |
| 404 | [ |
| 405 | 'name' => 'ekit_contact_form_input_hover_style_box_shadow', |
| 406 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 407 | 'selector' => ' |
| 408 | {{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):hover, |
| 409 | {{WRAPPER}} .ekit-form form textarea:hover, {{WRAPPER}} .ekit-form form select:hover' |
| 410 | , |
| 411 | ] |
| 412 | ); |
| 413 | |
| 414 | $this->end_controls_tab(); |
| 415 | $this->start_controls_tab( |
| 416 | 'ekit_contact_form_input_focus_tab', |
| 417 | [ |
| 418 | 'label' => esc_html__( 'Focus', 'elementskit-lite' ), |
| 419 | ] |
| 420 | ); |
| 421 | |
| 422 | $this->add_group_control( |
| 423 | Group_Control_Background::get_type(), |
| 424 | [ |
| 425 | 'name' => 'ekit_contact_form_input_focus_style_background', |
| 426 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 427 | 'types' => [ 'classic', 'gradient' ], |
| 428 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):focus ,{{WRAPPER}} .ekit-form form textarea:focus, {{WRAPPER}} .ekit-form form select:focus', |
| 429 | 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 430 | ] |
| 431 | ); |
| 432 | |
| 433 | $this->add_responsive_control( |
| 434 | 'ekit_contact_form_input_focus_style_radius', |
| 435 | [ |
| 436 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 437 | 'type' => Controls_Manager::DIMENSIONS, |
| 438 | 'size_units' => [ 'px', '%' ], |
| 439 | 'selectors' => [ |
| 440 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):focus, {{WRAPPER}} .ekit-form form select:focus' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 441 | '{{WRAPPER}} .ekit-form form textarea:focus' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 442 | ], |
| 443 | ] |
| 444 | ); |
| 445 | |
| 446 | $this->add_group_control( |
| 447 | Group_Control_Border::get_type(), |
| 448 | [ |
| 449 | 'name' => 'ekit_contact_form_input_focus_style_border', |
| 450 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 451 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):focus, {{WRAPPER}} .ekit-form form textarea:focus, {{WRAPPER}} .ekit-form form select:focus', |
| 452 | ] |
| 453 | ); |
| 454 | |
| 455 | $this->add_group_control( |
| 456 | Group_Control_Box_Shadow::get_type(), |
| 457 | [ |
| 458 | 'name' => 'ekit_contact_form_input_focus_style_box_shadow', |
| 459 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 460 | 'selector' => ' |
| 461 | {{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):focus, |
| 462 | {{WRAPPER}} .ekit-form form textarea:focus, {{WRAPPER}} .ekit-form form select:focus' |
| 463 | , |
| 464 | ] |
| 465 | ); |
| 466 | |
| 467 | $this->end_controls_tab(); |
| 468 | |
| 469 | $this->end_controls_tabs(); |
| 470 | |
| 471 | $this->add_control( |
| 472 | 'ekit_contact_form_input_style_typography_heading', |
| 473 | [ |
| 474 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 475 | 'type' => Controls_Manager::HEADING, |
| 476 | 'separator' => 'before', |
| 477 | ] |
| 478 | ); |
| 479 | |
| 480 | $this->add_group_control( |
| 481 | Group_Control_Typography::get_type(), |
| 482 | [ |
| 483 | 'name' => 'ekit_contact_form_input_typography', |
| 484 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 485 | 'selector' => '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), .wpcf7-form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .wpcf7-form textarea, {{WRAPPER}} .ekit-wid-con .ekit-form form textarea, {{WRAPPER}} .ekit-form form select', |
| 486 | ] |
| 487 | ); |
| 488 | |
| 489 | $this->add_responsive_control( |
| 490 | 'ekit_contact_form_input_style_font_color', |
| 491 | [ |
| 492 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 493 | 'type' => Controls_Manager::COLOR, |
| 494 | 'default' => '#000000', |
| 495 | 'selectors' => [ |
| 496 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), {{WRAPPER}} .ekit-form form select' => 'color: {{VALUE}}', |
| 497 | '{{WRAPPER}} .wpcf7-form textarea' => 'color: {{VALUE}}', |
| 498 | '{{WRAPPER}} .ekit-wid-con .ekit-form form textarea' => 'color: {{VALUE}}', |
| 499 | ], |
| 500 | ] |
| 501 | ); |
| 502 | |
| 503 | $this->add_control( |
| 504 | 'ekit_contact_form_input_style_placeholder_heading', |
| 505 | [ |
| 506 | 'label' => esc_html__( 'Placeholder', 'elementskit-lite' ), |
| 507 | 'type' => Controls_Manager::HEADING, |
| 508 | 'separator' => 'before', |
| 509 | ] |
| 510 | ); |
| 511 | |
| 512 | $this->add_responsive_control( |
| 513 | 'ekit_contact_form_input_style_placeholder_font_size', |
| 514 | [ |
| 515 | 'label' => esc_html__( 'Font Size', 'elementskit-lite' ), |
| 516 | 'type' => Controls_Manager::SLIDER, |
| 517 | 'size_units' => [ 'px' ], |
| 518 | 'range' => [ |
| 519 | 'px' => [ |
| 520 | 'min' => 0, |
| 521 | 'max' => 100, |
| 522 | 'step' => 1, |
| 523 | ], |
| 524 | ], |
| 525 | 'default' => [ |
| 526 | 'unit' => 'px', |
| 527 | 'size' => 14, |
| 528 | ], |
| 529 | 'selectors' => [ |
| 530 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"])::-webkit-input-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 531 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"])::-moz-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 532 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):-ms-input-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 533 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):-moz-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 534 | |
| 535 | '{{WRAPPER}} .ekit-form form textarea::-webkit-input-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 536 | '{{WRAPPER}} .ekit-form form textarea::-moz-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 537 | '{{WRAPPER}} .ekit-form form textarea:-ms-input-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 538 | '{{WRAPPER}} .ekit-form form textarea:-moz-placeholder' => 'font-size: {{SIZE}}{{UNIT}};', |
| 539 | ], |
| 540 | ] |
| 541 | ); |
| 542 | $this->add_responsive_control( |
| 543 | 'ekit_contact_form_input_placeholder_font_color', |
| 544 | [ |
| 545 | 'label' => esc_html__( 'Placeholder Color', 'elementskit-lite' ), |
| 546 | 'type' => Controls_Manager::COLOR, |
| 547 | 'default' => '#000000', |
| 548 | 'selectors' => [ |
| 549 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"])::-webkit-input-placeholder' => 'color: {{VALUE}}', |
| 550 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"])::-moz-placeholder' => 'color: {{VALUE}}', |
| 551 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):-ms-input-placeholder' => 'color: {{VALUE}}', |
| 552 | '{{WRAPPER}} .ekit-form form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):-moz-placeholder' => 'color: {{VALUE}}', |
| 553 | |
| 554 | '{{WRAPPER}} .ekit-form form textarea::-webkit-input-placeholder' => 'color: {{VALUE}}', |
| 555 | '{{WRAPPER}} .ekit-form form textarea::-moz-placeholder' => 'color: {{VALUE}}', |
| 556 | '{{WRAPPER}} .ekit-form form textarea:-ms-input-placeholder' => 'color: {{VALUE}}', |
| 557 | '{{WRAPPER}} .ekit-form form textarea:-moz-placeholder' => 'color: {{VALUE}}', |
| 558 | ], |
| 559 | ] |
| 560 | ); |
| 561 | |
| 562 | |
| 563 | $this->end_controls_section(); |
| 564 | |
| 565 | |
| 566 | |
| 567 | $this->start_controls_section( |
| 568 | 'ekit_contact_form_button_style_holder', |
| 569 | [ |
| 570 | 'label' => esc_html__( 'Button', 'elementskit-lite' ), |
| 571 | 'tab' => Controls_Manager::TAB_STYLE, |
| 572 | ] |
| 573 | ); |
| 574 | |
| 575 | $this->add_responsive_control( |
| 576 | 'ekit_contact_form_button_alignment', |
| 577 | [ |
| 578 | 'label' => esc_html__( 'Alignment', 'elementskit-lite' ), |
| 579 | 'type' => Controls_Manager::CHOOSE, |
| 580 | 'options' => [ |
| 581 | 'left' => [ |
| 582 | 'title' => esc_html__( 'Left', 'elementskit-lite' ), |
| 583 | 'icon' => 'eicon-text-align-left', |
| 584 | ], |
| 585 | 'center' => [ |
| 586 | 'title' => esc_html__( 'Center', 'elementskit-lite' ), |
| 587 | 'icon' => 'eicon-text-align-center', |
| 588 | ], |
| 589 | 'right' => [ |
| 590 | 'title' => esc_html__( 'Right', 'elementskit-lite' ), |
| 591 | 'icon' => 'eicon-text-align-right', |
| 592 | ], |
| 593 | ], |
| 594 | 'default' => 'left', |
| 595 | 'selectors'=> [ |
| 596 | '{{WRAPPER}} .ekit-form form > p' => 'text-align: {{VALUE}};', |
| 597 | ], |
| 598 | ] |
| 599 | ); |
| 600 | |
| 601 | $this->add_group_control( |
| 602 | Group_Control_Typography::get_type(), |
| 603 | [ |
| 604 | 'name' => 'ekit_contact_form_button_typography', |
| 605 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 606 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]', |
| 607 | ] |
| 608 | ); |
| 609 | |
| 610 | $this->add_responsive_control( |
| 611 | 'ekit_contact_form_button_border_radius', |
| 612 | [ |
| 613 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 614 | 'type' => Controls_Manager::DIMENSIONS, |
| 615 | 'size_units' => [ 'px', '%', 'em' ], |
| 616 | 'selectors' => [ |
| 617 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 618 | ], |
| 619 | ] |
| 620 | ); |
| 621 | |
| 622 | $this->add_responsive_control( |
| 623 | 'ekit_contact_form_button_border_padding', |
| 624 | [ |
| 625 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 626 | 'type' => Controls_Manager::DIMENSIONS, |
| 627 | 'size_units' => [ 'px', '%', 'em' ], |
| 628 | 'selectors' => [ |
| 629 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 630 | ], |
| 631 | ] |
| 632 | ); |
| 633 | |
| 634 | $this->add_responsive_control( |
| 635 | 'ekit_contact_form_button_style_margin', |
| 636 | [ |
| 637 | 'label' => esc_html__( 'Margin', 'elementskit-lite' ), |
| 638 | 'type' => Controls_Manager::DIMENSIONS, |
| 639 | 'size_units' => [ 'px', '%', 'em' ], |
| 640 | 'selectors' => [ |
| 641 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 642 | ], |
| 643 | ] |
| 644 | ); |
| 645 | |
| 646 | |
| 647 | $this->add_control( |
| 648 | 'ekit_contact_form_button_style_use_width_height', |
| 649 | [ |
| 650 | 'label' => esc_html__( 'Use Height Width', 'elementskit-lite' ), |
| 651 | 'type' => Controls_Manager::SWITCHER, |
| 652 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 653 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 654 | 'return_value' => 'yes', |
| 655 | 'default' => 'no', |
| 656 | ] |
| 657 | ); |
| 658 | |
| 659 | $this->add_responsive_control( |
| 660 | 'ekit_contact_form_button_width', |
| 661 | [ |
| 662 | 'label' => esc_html__( 'Width', 'elementskit-lite' ), |
| 663 | 'type' => Controls_Manager::SLIDER, |
| 664 | 'size_units' => [ 'px', '%' ], |
| 665 | 'range' => [ |
| 666 | 'px' => [ |
| 667 | 'min' => 50, |
| 668 | 'max' => 200, |
| 669 | 'step' => 1, |
| 670 | ], |
| 671 | '%' => [ |
| 672 | 'min' => 10, |
| 673 | 'max' => 100, |
| 674 | ], |
| 675 | ], |
| 676 | 'default' => [ |
| 677 | 'unit' => 'px', |
| 678 | 'size' => 50, |
| 679 | ], |
| 680 | 'selectors' => [ |
| 681 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'width: {{SIZE}}{{UNIT}};', |
| 682 | ], |
| 683 | 'condition' => [ |
| 684 | 'ekit_contact_form_button_style_use_width_height' => 'yes' |
| 685 | ] |
| 686 | ] |
| 687 | ); |
| 688 | |
| 689 | $this->add_responsive_control( |
| 690 | 'ekit_contact_form_button_style_height', |
| 691 | [ |
| 692 | 'label' => esc_html__( 'Height', 'elementskit-lite' ), |
| 693 | 'type' => Controls_Manager::SLIDER, |
| 694 | 'size_units' => [ 'px' ], |
| 695 | 'range' => [ |
| 696 | 'px' => [ |
| 697 | 'min' => 50, |
| 698 | 'max' => 200, |
| 699 | 'step' => 1, |
| 700 | ], |
| 701 | '%' => [ |
| 702 | 'min' => 10, |
| 703 | 'max' => 100, |
| 704 | ], |
| 705 | ], |
| 706 | 'default' => [ |
| 707 | 'unit' => 'px', |
| 708 | 'size' => 50, |
| 709 | ], |
| 710 | 'selectors' => [ |
| 711 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'height: {{SIZE}}{{UNIT}};', |
| 712 | ], |
| 713 | 'condition' => [ |
| 714 | 'ekit_contact_form_button_style_use_width_height' => 'yes' |
| 715 | ] |
| 716 | ] |
| 717 | ); |
| 718 | |
| 719 | $this->add_responsive_control( |
| 720 | 'ekit_contact_form_button_style_line_height', |
| 721 | [ |
| 722 | 'label' => esc_html__( 'Line Height', 'elementskit-lite' ), |
| 723 | 'type' => Controls_Manager::SLIDER, |
| 724 | 'size_units' => [ 'px' ], |
| 725 | 'range' => [ |
| 726 | 'px' => [ |
| 727 | 'min' => 50, |
| 728 | 'max' => 200, |
| 729 | 'step' => 1, |
| 730 | ], |
| 731 | '%' => [ |
| 732 | 'min' => 10, |
| 733 | 'max' => 100, |
| 734 | ], |
| 735 | ], |
| 736 | 'default' => [ |
| 737 | 'unit' => 'px', |
| 738 | 'size' => 50, |
| 739 | ], |
| 740 | 'selectors' => [ |
| 741 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'line-height: {{SIZE}}{{UNIT}};', |
| 742 | ], |
| 743 | 'condition' => [ |
| 744 | 'ekit_contact_form_button_style_use_width_height' => 'yes' |
| 745 | ] |
| 746 | ] |
| 747 | ); |
| 748 | |
| 749 | $this->start_controls_tabs( |
| 750 | 'ekit_contact_form_button_normal_and_hover_tabs' |
| 751 | ); |
| 752 | $this->start_controls_tab( |
| 753 | 'ekit_contact_form_button_normal_tab', |
| 754 | [ |
| 755 | 'label' => esc_html__( 'Normal', 'elementskit-lite' ), |
| 756 | ] |
| 757 | ); |
| 758 | |
| 759 | $this->add_responsive_control( |
| 760 | 'ekit_contact_form_button_color', |
| 761 | [ |
| 762 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 763 | 'type' => Controls_Manager::COLOR, |
| 764 | 'default' => '#ffffff', |
| 765 | 'selectors' => [ |
| 766 | '{{WRAPPER}} .ekit-form form input[type="submit"]' => 'color: {{VALUE}}', |
| 767 | ], |
| 768 | ] |
| 769 | ); |
| 770 | |
| 771 | $this->add_group_control( |
| 772 | Group_Control_Background::get_type(), |
| 773 | [ |
| 774 | 'name' => 'ekit_contact_form_button_background', |
| 775 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 776 | 'types' => [ 'classic', 'gradient', ], |
| 777 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]', |
| 778 | 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 779 | ] |
| 780 | ); |
| 781 | |
| 782 | $this->add_group_control( |
| 783 | Group_Control_Box_Shadow::get_type(), |
| 784 | [ |
| 785 | 'name' => 'ekit_contact_form_button_box_shadow', |
| 786 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 787 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]', |
| 788 | ] |
| 789 | ); |
| 790 | |
| 791 | $this->add_group_control( |
| 792 | Group_Control_Border::get_type(), |
| 793 | [ |
| 794 | 'name' => 'ekit_contact_form_button_border', |
| 795 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 796 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]', |
| 797 | ] |
| 798 | ); |
| 799 | |
| 800 | $this->add_group_control( |
| 801 | Group_Control_Text_Shadow::get_type(), |
| 802 | [ |
| 803 | 'name' => 'ekit_contact_form_button_title_shadow', |
| 804 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]' , |
| 805 | ] |
| 806 | ); |
| 807 | |
| 808 | $this->end_controls_tab(); |
| 809 | $this->start_controls_tab( |
| 810 | 'ekit_contact_form_button_hover_tab', |
| 811 | [ |
| 812 | 'label' => esc_html__( 'Hover', 'elementskit-lite' ), |
| 813 | ] |
| 814 | ); |
| 815 | |
| 816 | $this->add_responsive_control( |
| 817 | 'ekit_contact_form_button_color_hover', |
| 818 | [ |
| 819 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 820 | 'type' => Controls_Manager::COLOR, |
| 821 | 'default' => '#ffffff', |
| 822 | 'selectors' => [ |
| 823 | '{{WRAPPER}} .ekit-form form input[type="submit"]:hover' => 'color: {{VALUE}}', |
| 824 | ], |
| 825 | ] |
| 826 | ); |
| 827 | |
| 828 | $this->add_group_control( |
| 829 | Group_Control_Background::get_type(), |
| 830 | [ |
| 831 | 'name' => 'ekit_contact_form_button_hover_background', |
| 832 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 833 | 'types' => [ 'classic', 'gradient', ], |
| 834 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]:hover', |
| 835 | 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 836 | ] |
| 837 | ); |
| 838 | |
| 839 | $this->add_group_control( |
| 840 | Group_Control_Box_Shadow::get_type(), |
| 841 | [ |
| 842 | 'name' => 'ekit_contact_form_button_box_shadow_hover', |
| 843 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 844 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]:hover', |
| 845 | ] |
| 846 | ); |
| 847 | |
| 848 | $this->add_group_control( |
| 849 | Group_Control_Border::get_type(), |
| 850 | [ |
| 851 | 'name' => 'ekit_contact_form_button_border_hover', |
| 852 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 853 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]:hover', |
| 854 | ] |
| 855 | ); |
| 856 | |
| 857 | $this->add_group_control( |
| 858 | Group_Control_Text_Shadow::get_type(), |
| 859 | [ |
| 860 | 'name' => 'ekit_contact_form_button_title_shadow_hover', |
| 861 | 'selector' => '{{WRAPPER}} .ekit-form form input[type="submit"]:hover' , |
| 862 | ] |
| 863 | ); |
| 864 | |
| 865 | $this->end_controls_tab(); |
| 866 | |
| 867 | $this->end_controls_tabs(); |
| 868 | |
| 869 | $this->end_controls_section(); |
| 870 | |
| 871 | $this->insert_pro_message(); |
| 872 | } |
| 873 | |
| 874 | protected function render( ) { |
| 875 | echo '<div class="ekit-wid-con" >'; |
| 876 | $this->render_raw(); |
| 877 | echo '</div>'; |
| 878 | } |
| 879 | |
| 880 | protected function render_raw( ) { |
| 881 | |
| 882 | $settings = $this->get_settings(); |
| 883 | |
| 884 | echo '<div class="ekit-form">'; |
| 885 | echo do_shortcode('[contact-form-7 id="'.intval($settings['ekit_contact_form7']).'"]' ); |
| 886 | echo '</div>'; |
| 887 | } |
| 888 | } |
| 889 |