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