wp-forms.php
687 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use \Elementor\ElementsKit_Widget_Wp_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_Wp_Forms extends Widget_Base { |
| 10 | use \ElementsKit_Lite\Widgets\Widget_Notice; |
| 11 | |
| 12 | public $base; |
| 13 | |
| 14 | public function __construct( $data = [], $args = null ) { |
| 15 | parent::__construct( $data, $args ); |
| 16 | $this->add_script_depends('wpforms'); |
| 17 | } |
| 18 | |
| 19 | public function get_name() { |
| 20 | return Handler::get_name(); |
| 21 | } |
| 22 | |
| 23 | public function get_title() { |
| 24 | return Handler::get_title(); |
| 25 | } |
| 26 | |
| 27 | public function get_icon() { |
| 28 | return Handler::get_icon(); |
| 29 | } |
| 30 | |
| 31 | public function get_categories() { |
| 32 | return Handler::get_categories(); |
| 33 | } |
| 34 | |
| 35 | public function get_keywords() { |
| 36 | return Handler::get_keywords(); |
| 37 | } |
| 38 | |
| 39 | public function get_help_url() { |
| 40 | return 'https://wpmet.com/doc/wp-forms/'; |
| 41 | } |
| 42 | |
| 43 | public function get_style_depends() { |
| 44 | return ['ekit-wp-forms']; |
| 45 | } |
| 46 | |
| 47 | protected function is_dynamic_content(): bool { |
| 48 | return false; |
| 49 | } |
| 50 | protected function register_controls() { |
| 51 | $this->start_controls_section( |
| 52 | 'ekit_wpform_section_tab', [ |
| 53 | 'label' =>esc_html__( 'wpForm', 'elementskit-lite' ), |
| 54 | ] |
| 55 | ); |
| 56 | |
| 57 | $this->add_control( |
| 58 | 'ekit_wpform_form_id', |
| 59 | [ |
| 60 | 'label' => __( 'Select Your Form', 'elementskit-lite' ), |
| 61 | 'type' => Controls_Manager::SELECT, |
| 62 | 'label_block' => true, |
| 63 | 'default' => '0', |
| 64 | 'options' => \ElementsKit_Lite\Utils::ekit_get__forms('wpforms'), |
| 65 | ] |
| 66 | ); |
| 67 | |
| 68 | $this->end_controls_section(); |
| 69 | |
| 70 | /** Labels **/ |
| 71 | $this->start_controls_section( |
| 72 | 'ekit_wpForms_section_label_style', |
| 73 | [ |
| 74 | 'label' => __( 'Labels', 'elementskit-lite' ), |
| 75 | 'tab' => Controls_Manager::TAB_STYLE, |
| 76 | ] |
| 77 | ); |
| 78 | |
| 79 | $this->add_control( |
| 80 | 'ekit_wpForms_text_color_label', |
| 81 | [ |
| 82 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 83 | 'type' => Controls_Manager::COLOR, |
| 84 | 'selectors' => [ |
| 85 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field label' => 'color: {{VALUE}}', |
| 86 | ], |
| 87 | ] |
| 88 | ); |
| 89 | |
| 90 | $this->add_group_control( |
| 91 | Group_Control_Typography::get_type(), |
| 92 | [ |
| 93 | 'name' => 'ekit_wpForms_typography_label', |
| 94 | 'label' => __( 'Typography', 'elementskit-lite' ), |
| 95 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field label', |
| 96 | ] |
| 97 | ); |
| 98 | |
| 99 | $this->end_controls_section(); |
| 100 | |
| 101 | /** Input & Textarea **/ |
| 102 | $this->start_controls_section( |
| 103 | 'ekit_wpForms_section_fields_style', |
| 104 | [ |
| 105 | 'label' => __( 'Input & Textarea', 'elementskit-lite' ), |
| 106 | 'tab' => Controls_Manager::TAB_STYLE, |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $this->add_responsive_control( |
| 111 | 'ekit_wpForms_input_alignment', |
| 112 | [ |
| 113 | 'label' => __( 'Alignment', 'elementskit-lite' ), |
| 114 | 'type' => Controls_Manager::CHOOSE, |
| 115 | 'options' => [ |
| 116 | 'left' => [ |
| 117 | 'title' => __( 'Left', 'elementskit-lite' ), |
| 118 | 'icon' => 'eicon-text-align-left', |
| 119 | ], |
| 120 | 'center' => [ |
| 121 | 'title' => __( 'Center', 'elementskit-lite' ), |
| 122 | 'icon' => 'eicon-text-align-center', |
| 123 | ], |
| 124 | 'right' => [ |
| 125 | 'title' => __( 'Right', 'elementskit-lite' ), |
| 126 | 'icon' => 'eicon-text-align-right', |
| 127 | ], |
| 128 | ], |
| 129 | 'default' => '', |
| 130 | 'selectors' => [ |
| 131 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select' => 'text-align: {{VALUE}};', |
| 132 | ], |
| 133 | ] |
| 134 | ); |
| 135 | |
| 136 | $this->start_controls_tabs( 'ekit_wpForms_tabs_fields_style' ); |
| 137 | |
| 138 | $this->start_controls_tab( |
| 139 | 'ekit_wpForms_tab_fields_normal', |
| 140 | [ |
| 141 | 'label' => __( 'Normal', 'elementskit-lite' ), |
| 142 | ] |
| 143 | ); |
| 144 | |
| 145 | $this->add_control( |
| 146 | 'ekit_wpForms_field_bg_color', |
| 147 | [ |
| 148 | 'label' => __( 'Background Color', 'elementskit-lite' ), |
| 149 | 'type' => Controls_Manager::COLOR, |
| 150 | 'default' => '', |
| 151 | 'selectors' => [ |
| 152 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select' => 'background-color: {{VALUE}}', |
| 153 | ], |
| 154 | ] |
| 155 | ); |
| 156 | |
| 157 | $this->add_control( |
| 158 | 'ekit_wpForms_field_text_color', |
| 159 | [ |
| 160 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 161 | 'type' => Controls_Manager::COLOR, |
| 162 | 'default' => '', |
| 163 | 'selectors' => [ |
| 164 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select' => 'color: {{VALUE}}', |
| 165 | ], |
| 166 | ] |
| 167 | ); |
| 168 | |
| 169 | $this->add_group_control( |
| 170 | Group_Control_Border::get_type(), |
| 171 | [ |
| 172 | 'name' => 'ekit_wpForms_field_border', |
| 173 | 'label' => __( 'Border', 'elementskit-lite' ), |
| 174 | 'placeholder' => '1px', |
| 175 | 'default' => '1px', |
| 176 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select', |
| 177 | 'separator' => 'before', |
| 178 | ] |
| 179 | ); |
| 180 | |
| 181 | $this->add_control( |
| 182 | 'ekit_wpForms_field_radius', |
| 183 | [ |
| 184 | 'label' => __( 'Border Radius', 'elementskit-lite' ), |
| 185 | 'type' => Controls_Manager::DIMENSIONS, |
| 186 | 'size_units' => [ 'px', 'em', '%' ], |
| 187 | 'selectors' => [ |
| 188 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 189 | ], |
| 190 | ] |
| 191 | ); |
| 192 | |
| 193 | $this->add_control( |
| 194 | 'ekit_wpForms_hr_1', |
| 195 | [ |
| 196 | 'type' => Controls_Manager::DIVIDER, |
| 197 | ] |
| 198 | ); |
| 199 | |
| 200 | $this->add_responsive_control( |
| 201 | 'ekit_wpForms_input_width', |
| 202 | [ |
| 203 | 'label' => __( 'Input Width', 'elementskit-lite' ), |
| 204 | 'type' => Controls_Manager::SLIDER, |
| 205 | 'range' => [ |
| 206 | 'px' => [ |
| 207 | 'min' => 0, |
| 208 | 'max' => 1200, |
| 209 | 'step' => 1, |
| 210 | ], |
| 211 | ], |
| 212 | 'size_units' => [ 'px', 'em', '%' ], |
| 213 | 'selectors' => [ |
| 214 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field select' => 'width: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}}', |
| 215 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-form .wpforms-field-row.wpforms-field-medium' => 'width: {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}}', |
| 216 | ], |
| 217 | ] |
| 218 | ); |
| 219 | |
| 220 | $this->add_control( |
| 221 | 'ekit_wpForms_hr_2', |
| 222 | [ |
| 223 | 'type' => Controls_Manager::DIVIDER, |
| 224 | ] |
| 225 | ); |
| 226 | |
| 227 | $this->add_responsive_control( |
| 228 | 'ekit_wpForms_textarea_width', |
| 229 | [ |
| 230 | 'label' => __( 'Textarea Width', 'elementskit-lite' ), |
| 231 | 'type' => Controls_Manager::SLIDER, |
| 232 | 'range' => [ |
| 233 | 'px' => [ |
| 234 | 'min' => 0, |
| 235 | 'max' => 1200, |
| 236 | 'step' => 1, |
| 237 | ], |
| 238 | ], |
| 239 | 'size_units' => [ 'px', 'em', '%' ], |
| 240 | 'selectors' => [ |
| 241 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea' => 'width: {{SIZE}}{{UNIT}}', |
| 242 | ], |
| 243 | ] |
| 244 | ); |
| 245 | |
| 246 | $this->add_responsive_control( |
| 247 | 'ekit_wpForms_textarea_height', |
| 248 | [ |
| 249 | 'label' => __( 'Textarea Height', 'elementskit-lite' ), |
| 250 | 'type' => Controls_Manager::SLIDER, |
| 251 | 'range' => [ |
| 252 | 'px' => [ |
| 253 | 'min' => 0, |
| 254 | 'max' => 400, |
| 255 | 'step' => 1, |
| 256 | ], |
| 257 | ], |
| 258 | 'size_units' => [ 'px', 'em', '%' ], |
| 259 | 'selectors' => [ |
| 260 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea' => 'height: {{SIZE}}{{UNIT}}', |
| 261 | ], |
| 262 | ] |
| 263 | ); |
| 264 | |
| 265 | $this->add_responsive_control( |
| 266 | 'ekit_wpForms_field_padding', |
| 267 | [ |
| 268 | 'label' => __( 'Padding', 'elementskit-lite' ), |
| 269 | 'type' => Controls_Manager::DIMENSIONS, |
| 270 | 'size_units' => [ 'px', 'em', '%' ], |
| 271 | 'selectors' => [ |
| 272 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 273 | ], |
| 274 | 'separator' => 'before', |
| 275 | ] |
| 276 | ); |
| 277 | |
| 278 | $this->add_responsive_control( |
| 279 | 'ekit_wpForms_field_spacing', |
| 280 | [ |
| 281 | 'label' => __( 'Margin', 'elementskit-lite' ), |
| 282 | 'type' => Controls_Manager::DIMENSIONS, |
| 283 | 'size_units' => [ 'px', 'em', '%' ], |
| 284 | 'selectors' => [ |
| 285 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 286 | ], |
| 287 | 'separator' => 'before', |
| 288 | ] |
| 289 | ); |
| 290 | |
| 291 | $this->add_group_control( |
| 292 | Group_Control_Box_Shadow::get_type(), |
| 293 | [ |
| 294 | 'name' => 'ekit_wpForms_field_box_shadow', |
| 295 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select', |
| 296 | 'separator' => 'before', |
| 297 | ] |
| 298 | ); |
| 299 | |
| 300 | $this->end_controls_tab(); |
| 301 | |
| 302 | $this->start_controls_tab( |
| 303 | 'ekit_wpForms_tab_fields_focus', |
| 304 | [ |
| 305 | 'label' => __( 'Focus', 'elementskit-lite' ), |
| 306 | ] |
| 307 | ); |
| 308 | |
| 309 | $this->add_group_control( |
| 310 | Group_Control_Border::get_type(), |
| 311 | [ |
| 312 | 'name' => 'ekit_wpForms_focus_input_border', |
| 313 | 'label' => __( 'Border', 'elementskit-lite' ), |
| 314 | 'placeholder' => '1px', |
| 315 | 'default' => '1px', |
| 316 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:focus, {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea:focus', |
| 317 | ] |
| 318 | ); |
| 319 | |
| 320 | $this->add_group_control( |
| 321 | Group_Control_Box_Shadow::get_type(), |
| 322 | [ |
| 323 | 'name' => 'ekit_wpForms_focus_box_shadow', |
| 324 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:focus, {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea:focus', |
| 325 | 'separator' => 'before', |
| 326 | ] |
| 327 | ); |
| 328 | |
| 329 | $this->end_controls_tab(); |
| 330 | |
| 331 | $this->end_controls_tabs(); |
| 332 | |
| 333 | $this->end_controls_section(); |
| 334 | |
| 335 | /** Field Description **/ |
| 336 | $this->start_controls_section( |
| 337 | 'ekit_wpForms_section_field_description_style', |
| 338 | [ |
| 339 | 'label' => __( 'Field Description', 'elementskit-lite' ), |
| 340 | 'tab' => Controls_Manager::TAB_STYLE, |
| 341 | ] |
| 342 | ); |
| 343 | |
| 344 | $this->add_control( |
| 345 | 'ekit_wpForms_field_description_text_color', |
| 346 | [ |
| 347 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 348 | 'type' => Controls_Manager::COLOR, |
| 349 | 'selectors' => [ |
| 350 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field .wpforms-field-description, {{WRAPPER}} .ekit_wpForms_container .wpforms-field .wpforms-field-sublabel' => 'color: {{VALUE}}', |
| 351 | ], |
| 352 | ] |
| 353 | ); |
| 354 | |
| 355 | $this->add_group_control( |
| 356 | Group_Control_Typography::get_type(), |
| 357 | [ |
| 358 | 'name' => 'ekit_wpForms_field_description_typography', |
| 359 | 'label' => __( 'Typography', 'elementskit-lite' ), |
| 360 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field .wpforms-field-description, {{WRAPPER}} .ekit_wpForms_container .wpforms-field .wpforms-field-sublabel', |
| 361 | ] |
| 362 | ); |
| 363 | |
| 364 | $this->add_responsive_control( |
| 365 | 'ekit_wpForms_field_description_spacing', |
| 366 | [ |
| 367 | 'label' => __( 'Padding', 'elementskit-lite' ), |
| 368 | 'type' => Controls_Manager::DIMENSIONS, |
| 369 | 'size_units' => [ 'px', 'em', '%' ], |
| 370 | 'selectors' => [ |
| 371 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field .wpforms-field-description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 372 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field .wpforms-field-sublabel' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 373 | ], |
| 374 | 'separator' => 'before', |
| 375 | ] |
| 376 | ); |
| 377 | |
| 378 | $this->end_controls_section(); |
| 379 | |
| 380 | /** Placeholder **/ |
| 381 | $this->start_controls_section( |
| 382 | 'ekit_wpForms_section_placeholder_style', |
| 383 | [ |
| 384 | 'label' => __( 'Placeholder', 'elementskit-lite' ), |
| 385 | 'tab' => Controls_Manager::TAB_STYLE, |
| 386 | ] |
| 387 | ); |
| 388 | |
| 389 | $this->add_group_control( |
| 390 | Group_Control_Typography::get_type(), |
| 391 | [ |
| 392 | 'name' => 'ekit_wpForms_field_typography', |
| 393 | 'label' => __( 'Typography', 'elementskit-lite' ), |
| 394 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea, {{WRAPPER}} .ekit_wpForms_container .wpforms-field select', |
| 395 | 'separator' => 'before', |
| 396 | ] |
| 397 | ); |
| 398 | |
| 399 | $this->add_control( |
| 400 | 'ekit_wpForms_text_color_placeholder', |
| 401 | [ |
| 402 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 403 | 'type' => Controls_Manager::COLOR, |
| 404 | 'selectors' => [ |
| 405 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-field input::-webkit-input-placeholder, {{WRAPPER}} .ekit_wpForms_container .wpforms-field textarea::-webkit-input-placeholder' => 'color: {{VALUE}}', |
| 406 | ], |
| 407 | ] |
| 408 | ); |
| 409 | |
| 410 | $this->end_controls_section(); |
| 411 | |
| 412 | |
| 413 | /** Submit Button **/ |
| 414 | $this->start_controls_section( |
| 415 | 'ekit_wpForms_section_submit_button_style', |
| 416 | [ |
| 417 | 'label' => __( 'Submit Button', 'elementskit-lite' ), |
| 418 | 'tab' => Controls_Manager::TAB_STYLE, |
| 419 | ] |
| 420 | ); |
| 421 | |
| 422 | $this->add_control( |
| 423 | 'ekit_wpForms_button_width_type', |
| 424 | [ |
| 425 | 'label' => __( 'Width', 'elementskit-lite' ), |
| 426 | 'type' => Controls_Manager::SELECT, |
| 427 | 'default' => 'custom', |
| 428 | 'options' => [ |
| 429 | 'full-width' => __( 'Full Width', 'elementskit-lite' ), |
| 430 | 'custom' => __( 'Custom', 'elementskit-lite' ), |
| 431 | ], |
| 432 | 'prefix_class' => 'ekit_wpForms_container-form-button-', |
| 433 | ] |
| 434 | ); |
| 435 | |
| 436 | $this->add_responsive_control( |
| 437 | 'ekit_wpForms_button_align', |
| 438 | [ |
| 439 | 'label' => __( 'Alignment', 'elementskit-lite' ), |
| 440 | 'type' => Controls_Manager::CHOOSE, |
| 441 | 'options' => [ |
| 442 | 'left' => [ |
| 443 | 'title' => __( 'Left', 'elementskit-lite' ), |
| 444 | 'icon' => 'eicon-h-align-left', |
| 445 | ], |
| 446 | 'center' => [ |
| 447 | 'title' => __( 'Center', 'elementskit-lite' ), |
| 448 | 'icon' => 'eicon-h-align-center', |
| 449 | ], |
| 450 | 'right' => [ |
| 451 | 'title' => __( 'Right', 'elementskit-lite' ), |
| 452 | 'icon' => 'eicon-h-align-right', |
| 453 | ], |
| 454 | ], |
| 455 | 'default' => '', |
| 456 | 'selectors' => [ |
| 457 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container' => 'text-align: {{VALUE}};', |
| 458 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit' => 'display:inline-block;' |
| 459 | ], |
| 460 | 'condition' => [ |
| 461 | 'ekit_wpForms_button_width_type' => 'custom', |
| 462 | ], |
| 463 | ] |
| 464 | ); |
| 465 | |
| 466 | $this->add_responsive_control( |
| 467 | 'ekit_wpForms_button_width', |
| 468 | [ |
| 469 | 'label' => __( 'Width', 'elementskit-lite' ), |
| 470 | 'type' => Controls_Manager::SLIDER, |
| 471 | 'range' => [ |
| 472 | 'px' => [ |
| 473 | 'min' => 0, |
| 474 | 'max' => 1200, |
| 475 | 'step' => 1, |
| 476 | ], |
| 477 | ], |
| 478 | 'size_units' => [ 'px', '%' ], |
| 479 | 'selectors' => [ |
| 480 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit' => 'width: {{SIZE}}{{UNIT}}', |
| 481 | ], |
| 482 | 'condition' => [ |
| 483 | 'ekit_wpForms_button_width_type' => 'custom', |
| 484 | ], |
| 485 | ] |
| 486 | ); |
| 487 | |
| 488 | $this->start_controls_tabs( 'ekit_wpForms_tabs_button_style' ); |
| 489 | |
| 490 | $this->start_controls_tab( |
| 491 | 'ekit_wpForms_tab_button_normal', |
| 492 | [ |
| 493 | 'label' => __( 'Normal', 'elementskit-lite' ), |
| 494 | ] |
| 495 | ); |
| 496 | |
| 497 | $this->add_group_control( |
| 498 | Group_Control_Typography::get_type(), |
| 499 | [ |
| 500 | 'name' => 'ekit_wpForms_button_typography', |
| 501 | 'label' => __( 'Typography', 'elementskit-lite' ), |
| 502 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit', |
| 503 | 'separator' => 'before', |
| 504 | ] |
| 505 | ); |
| 506 | |
| 507 | $this->add_control( |
| 508 | 'ekit_wpForms_button_bg_color_normal', |
| 509 | [ |
| 510 | 'label' => __( 'Background Color', 'elementskit-lite' ), |
| 511 | 'type' => Controls_Manager::COLOR, |
| 512 | 'default' => '', |
| 513 | 'selectors' => [ |
| 514 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit' => 'background-color: {{VALUE}}', |
| 515 | ], |
| 516 | ] |
| 517 | ); |
| 518 | |
| 519 | $this->add_control( |
| 520 | 'ekit_wpForms_button_text_color_normal', |
| 521 | [ |
| 522 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 523 | 'type' => Controls_Manager::COLOR, |
| 524 | 'default' => '', |
| 525 | 'selectors' => [ |
| 526 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit' => 'color: {{VALUE}}', |
| 527 | ], |
| 528 | ] |
| 529 | ); |
| 530 | |
| 531 | $this->add_group_control( |
| 532 | Group_Control_Box_Shadow::get_type(), |
| 533 | [ |
| 534 | 'name' => 'ekit_wpForms_button_box_shadow', |
| 535 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit', |
| 536 | 'separator' => 'before', |
| 537 | ] |
| 538 | ); |
| 539 | |
| 540 | $this->add_group_control( |
| 541 | Group_Control_Border::get_type(), |
| 542 | [ |
| 543 | 'name' => 'ekit_wpForms_button_border_normal', |
| 544 | 'label' => __( 'Border', 'elementskit-lite' ), |
| 545 | 'placeholder' => '1px', |
| 546 | 'default' => '1px', |
| 547 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit', |
| 548 | ] |
| 549 | ); |
| 550 | |
| 551 | $this->add_control( |
| 552 | 'ekit_wpForms_button_border_radius', |
| 553 | [ |
| 554 | 'label' => __( 'Border Radius', 'elementskit-lite' ), |
| 555 | 'type' => Controls_Manager::DIMENSIONS, |
| 556 | 'size_units' => [ 'px', 'em', '%' ], |
| 557 | 'selectors' => [ |
| 558 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 559 | ], |
| 560 | ] |
| 561 | ); |
| 562 | |
| 563 | $this->add_responsive_control( |
| 564 | 'ekit_wpForms_button_padding', |
| 565 | [ |
| 566 | 'label' => __( 'Padding', 'elementskit-lite' ), |
| 567 | 'type' => Controls_Manager::DIMENSIONS, |
| 568 | 'size_units' => [ 'px', 'em', '%' ], |
| 569 | 'selectors' => [ |
| 570 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 571 | ], |
| 572 | ] |
| 573 | ); |
| 574 | |
| 575 | $this->add_responsive_control( |
| 576 | 'ekit_wpForms_button_margin', |
| 577 | [ |
| 578 | 'label' => __( 'Margin', 'elementskit-lite' ), |
| 579 | 'type' => Controls_Manager::DIMENSIONS, |
| 580 | 'size_units' => [ 'px', 'em', '%' ], |
| 581 | 'selectors' => [ |
| 582 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 583 | ], |
| 584 | ] |
| 585 | ); |
| 586 | |
| 587 | $this->end_controls_tab(); |
| 588 | |
| 589 | $this->start_controls_tab( |
| 590 | 'ekit_wpForms_tab_button_hover', |
| 591 | [ |
| 592 | 'label' => __( 'Hover', 'elementskit-lite' ), |
| 593 | ] |
| 594 | ); |
| 595 | |
| 596 | $this->add_control( |
| 597 | 'ekit_wpForms_button_bg_color_hover', |
| 598 | [ |
| 599 | 'label' => __( 'Background Color', 'elementskit-lite' ), |
| 600 | 'type' => Controls_Manager::COLOR, |
| 601 | 'default' => '', |
| 602 | 'selectors' => [ |
| 603 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit:hover' => 'background-color: {{VALUE}}', |
| 604 | ], |
| 605 | ] |
| 606 | ); |
| 607 | |
| 608 | $this->add_control( |
| 609 | 'ekit_wpForms_button_text_color_hover', |
| 610 | [ |
| 611 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 612 | 'type' => Controls_Manager::COLOR, |
| 613 | 'default' => '', |
| 614 | 'selectors' => [ |
| 615 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit:hover' => 'color: {{VALUE}}', |
| 616 | ], |
| 617 | ] |
| 618 | ); |
| 619 | |
| 620 | $this->add_control( |
| 621 | 'ekit_wpForms_button_border_color_hover', |
| 622 | [ |
| 623 | 'label' => __( 'Border Color', 'elementskit-lite' ), |
| 624 | 'type' => Controls_Manager::COLOR, |
| 625 | 'default' => '', |
| 626 | 'selectors' => [ |
| 627 | '{{WRAPPER}} .ekit_wpForms_container .wpforms-submit-container .wpforms-submit:hover' => 'border-color: {{VALUE}}', |
| 628 | ], |
| 629 | ] |
| 630 | ); |
| 631 | |
| 632 | $this->end_controls_tab(); |
| 633 | |
| 634 | $this->end_controls_tabs(); |
| 635 | |
| 636 | $this->end_controls_section(); |
| 637 | |
| 638 | /** Errors **/ |
| 639 | $this->start_controls_section( |
| 640 | 'ekit_wpForms_section_error_style', |
| 641 | [ |
| 642 | 'label' => __( 'Errors', 'elementskit-lite' ), |
| 643 | 'tab' => Controls_Manager::TAB_STYLE, |
| 644 | ] |
| 645 | ); |
| 646 | |
| 647 | $this->add_control( |
| 648 | 'ekit_wpForms_error_message_text_color', |
| 649 | [ |
| 650 | 'label' => __( 'Text Color', 'elementskit-lite' ), |
| 651 | 'type' => Controls_Manager::COLOR, |
| 652 | 'default' => '', |
| 653 | 'selectors' => [ |
| 654 | '{{WRAPPER}} .ekit_wpForms_container label.wpforms-error' => 'color: {{VALUE}}', |
| 655 | ], |
| 656 | ] |
| 657 | ); |
| 658 | |
| 659 | $this->add_group_control( |
| 660 | Group_Control_Border::get_type(), |
| 661 | [ |
| 662 | 'name' => 'ekit_wpForms_error_field_input_border', |
| 663 | 'label' => __( 'Border', 'elementskit-lite' ), |
| 664 | 'selector' => '{{WRAPPER}} .ekit_wpForms_container input.wpforms-error, {{WRAPPER}} .ekit_wpForms_container textarea.wpforms-error', |
| 665 | ] |
| 666 | ); |
| 667 | |
| 668 | $this->end_controls_section(); |
| 669 | |
| 670 | $this->insert_pro_message(); |
| 671 | } |
| 672 | |
| 673 | protected function render( ) { |
| 674 | echo '<div class="ekit-wid-con ekit_wpForms_container">'; |
| 675 | $this->render_raw(); |
| 676 | echo '</div>'; |
| 677 | } |
| 678 | |
| 679 | protected function render_raw( ) { |
| 680 | $settings = $this->get_settings(); |
| 681 | |
| 682 | if ( ! empty( $settings['ekit_wpform_form_id'] ) ) { |
| 683 | echo do_shortcode('[wpforms id="'.intval($settings['ekit_wpform_form_id']).'"]' ); |
| 684 | } |
| 685 | } |
| 686 | } |
| 687 |