| 1 |
<?php |
| 2 |
|
| 3 |
namespace MasterAddons\Addons; |
| 4 |
|
| 5 |
// Elementor Classes |
| 6 |
use MasterAddons\Inc\Classes\Base\Master_Widget; |
| 7 |
use \Elementor\Controls_Stack; |
| 8 |
use \Elementor\Controls_Manager; |
| 9 |
use \Elementor\Group_Control_Border; |
| 10 |
use \Elementor\Group_Control_Typography; |
| 11 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 12 |
use \Elementor\Group_Control_Box_Shadow; |
| 13 |
|
| 14 |
use MasterAddons\Inc\Classes\Helper; |
| 15 |
use MasterAddons\Inc\Admin\Config; |
| 16 |
|
| 17 |
if (!defined('ABSPATH')) exit; // If this file is called directly, abort. |
| 18 |
|
| 19 |
class Caldera_Forms extends Master_Widget |
| 20 |
{ |
| 21 |
use \MasterAddons\Inc\Traits\Widget_Notice; |
| 22 |
use \MasterAddons\Inc\Traits\Widget_Assets_Trait; |
| 23 |
|
| 24 |
public function get_name() |
| 25 |
{ |
| 26 |
return 'ma-caldera-forms'; |
| 27 |
} |
| 28 |
public function get_title() |
| 29 |
{ |
| 30 |
return esc_html__('Caldera Forms', 'master-addons' ); |
| 31 |
} |
| 32 |
|
| 33 |
public function get_icon() |
| 34 |
{ |
| 35 |
return 'jltma-icon ' . Config::get_addon_icon('caldera-forms'); |
| 36 |
} |
| 37 |
|
| 38 |
// for Cached Output |
| 39 |
|
| 40 |
protected function register_controls() |
| 41 |
{ |
| 42 |
|
| 43 |
/*-----------------------------------------------------------------------------------*/ |
| 44 |
/* Content Tab |
| 45 |
/*-----------------------------------------------------------------------------------*/ |
| 46 |
|
| 47 |
/** |
| 48 |
* Content Tab: Caldera Forms |
| 49 |
* ------------------------------------------------- |
| 50 |
*/ |
| 51 |
$this->start_controls_section( |
| 52 |
'section_info_box', |
| 53 |
[ |
| 54 |
'label' => esc_html__('Caldera Forms', 'master-addons' ), |
| 55 |
] |
| 56 |
); |
| 57 |
|
| 58 |
$this->add_control( |
| 59 |
'contact_form_list', |
| 60 |
[ |
| 61 |
'label' => esc_html__('Contact Form', 'master-addons' ), |
| 62 |
'type' => Controls_Manager::SELECT, |
| 63 |
'label_block' => true, |
| 64 |
'options' => Helper::ma_el_get_caldera_forms(), |
| 65 |
'default' => '0', |
| 66 |
] |
| 67 |
); |
| 68 |
|
| 69 |
$this->add_control( |
| 70 |
'custom_title_description', |
| 71 |
[ |
| 72 |
'label' => __('Custom Title & Description', 'master-addons' ), |
| 73 |
'type' => Controls_Manager::SWITCHER, |
| 74 |
'label_on' => __('Yes', 'master-addons' ), |
| 75 |
'label_off' => __('No', 'master-addons' ), |
| 76 |
'return_value' => 'yes', |
| 77 |
] |
| 78 |
); |
| 79 |
|
| 80 |
$this->add_control( |
| 81 |
'form_title_custom', |
| 82 |
[ |
| 83 |
'label' => esc_html__('Title', 'master-addons' ), |
| 84 |
'type' => Controls_Manager::TEXT, |
| 85 |
'label_block' => true, |
| 86 |
'default' => '', |
| 87 |
'condition' => [ |
| 88 |
'custom_title_description' => 'yes', |
| 89 |
], |
| 90 |
] |
| 91 |
); |
| 92 |
|
| 93 |
$this->add_control( |
| 94 |
'form_description_custom', |
| 95 |
[ |
| 96 |
'label' => esc_html__('Description', 'master-addons' ), |
| 97 |
'type' => Controls_Manager::TEXTAREA, |
| 98 |
'default' => '', |
| 99 |
'condition' => [ |
| 100 |
'custom_title_description' => 'yes', |
| 101 |
], |
| 102 |
] |
| 103 |
); |
| 104 |
|
| 105 |
$this->add_control( |
| 106 |
'labels_switch', |
| 107 |
[ |
| 108 |
'label' => __('Labels', 'master-addons' ), |
| 109 |
'type' => Controls_Manager::SWITCHER, |
| 110 |
'default' => 'yes', |
| 111 |
'label_on' => __('Show', 'master-addons' ), |
| 112 |
'label_off' => __('Hide', 'master-addons' ), |
| 113 |
'return_value' => 'yes', |
| 114 |
'prefix_class' => 'jltma-caldera-form-labels-', |
| 115 |
] |
| 116 |
); |
| 117 |
|
| 118 |
$this->add_control( |
| 119 |
'placeholder_switch', |
| 120 |
[ |
| 121 |
'label' => __('Placeholder', 'master-addons' ), |
| 122 |
'type' => Controls_Manager::SWITCHER, |
| 123 |
'default' => 'yes', |
| 124 |
'label_on' => __('Show', 'master-addons' ), |
| 125 |
'label_off' => __('Hide', 'master-addons' ), |
| 126 |
'return_value' => 'yes', |
| 127 |
] |
| 128 |
); |
| 129 |
|
| 130 |
$this->end_controls_section(); |
| 131 |
|
| 132 |
/** |
| 133 |
* Content Tab: Errors |
| 134 |
* ------------------------------------------------- |
| 135 |
*/ |
| 136 |
$this->start_controls_section( |
| 137 |
'section_errors', |
| 138 |
[ |
| 139 |
'label' => __('Errors', 'master-addons' ), |
| 140 |
] |
| 141 |
); |
| 142 |
|
| 143 |
$this->add_control( |
| 144 |
'error_messages', |
| 145 |
[ |
| 146 |
'label' => __('Error Messages', 'master-addons' ), |
| 147 |
'type' => Controls_Manager::SELECT, |
| 148 |
'default' => 'show', |
| 149 |
'options' => [ |
| 150 |
'show' => __('Show', 'master-addons' ), |
| 151 |
'hide' => __('Hide', 'master-addons' ), |
| 152 |
], |
| 153 |
'selectors_dictionary' => [ |
| 154 |
'show' => 'block', |
| 155 |
'hide' => 'none', |
| 156 |
], |
| 157 |
'selectors' => [ |
| 158 |
'{{WRAPPER}} .jltma-caldera-form .has-error .parsley-required' => 'display: {{VALUE}} !important;', |
| 159 |
], |
| 160 |
] |
| 161 |
); |
| 162 |
|
| 163 |
$this->end_controls_section(); |
| 164 |
|
| 165 |
// Help Docs section (links from config.php) |
| 166 |
$this->jltma_help_docs('caldera-forms'); |
| 167 |
|
| 168 |
$this->upgrade_to_pro_message(); |
| 169 |
|
| 170 |
/*-----------------------------------------------------------------------------------*/ |
| 171 |
/* Style Tab |
| 172 |
/*-----------------------------------------------------------------------------------*/ |
| 173 |
|
| 174 |
$this->start_controls_section( |
| 175 |
'ma_caldera_form_section_style', |
| 176 |
[ |
| 177 |
'label' => esc_html__('Design Layout', 'master-addons' ), |
| 178 |
'tab' => Controls_Manager::TAB_STYLE, |
| 179 |
] |
| 180 |
); |
| 181 |
|
| 182 |
// Define default free options - Pro version overrides via filter |
| 183 |
$layout_style_options = apply_filters('master_addons/addons/caldera_forms/layout_style', [ |
| 184 |
'1' => __('Style One', 'master-addons'), |
| 185 |
'2' => __('Style Two', 'master-addons'), |
| 186 |
'3' => __('Style Three', 'master-addons'), |
| 187 |
'4' => __('Style Four', 'master-addons'), |
| 188 |
'5' => __('Style Five', 'master-addons'), |
| 189 |
'clf-pro-1' => __('Style Six (Pro)', 'master-addons'), |
| 190 |
'clf-pro-2' => __('Style Seven (Pro)', 'master-addons'), |
| 191 |
'clf-pro-3' => __('Style Eight (Pro)', 'master-addons'), |
| 192 |
'clf-pro-4' => __('Style Nine (Pro)', 'master-addons'), |
| 193 |
'clf-pro-5' => __('Style Ten (Pro)', 'master-addons'), |
| 194 |
'clf-pro-6' => __('Style Eleven (Pro)', 'master-addons'), |
| 195 |
]); |
| 196 |
|
| 197 |
$this->add_control( |
| 198 |
'ma_caldera_form_layout_style', |
| 199 |
[ |
| 200 |
'label' => __('Design Variations', 'master-addons'), |
| 201 |
'type' => Controls_Manager::SELECT, |
| 202 |
'default' => '1', |
| 203 |
'options' => $layout_style_options, |
| 204 |
'description' => Helper::upgrade_to_pro('10+ more Variations on'), |
| 205 |
] |
| 206 |
); |
| 207 |
|
| 208 |
|
| 209 |
$this->end_controls_section(); |
| 210 |
|
| 211 |
/** |
| 212 |
* Style Tab: Form Title & Description |
| 213 |
* ------------------------------------------------- |
| 214 |
*/ |
| 215 |
$this->start_controls_section( |
| 216 |
'section_form_title_style', |
| 217 |
[ |
| 218 |
'label' => __('Title & Description', 'master-addons' ), |
| 219 |
'tab' => Controls_Manager::TAB_STYLE, |
| 220 |
'condition' => [ |
| 221 |
'custom_title_description' => 'yes', |
| 222 |
], |
| 223 |
] |
| 224 |
); |
| 225 |
|
| 226 |
$this->add_responsive_control( |
| 227 |
'heading_alignment', |
| 228 |
[ |
| 229 |
'label' => __('Alignment', 'master-addons' ), |
| 230 |
'type' => Controls_Manager::CHOOSE, |
| 231 |
'options' => Helper::jltma_content_alignment(), |
| 232 |
'default' => '', |
| 233 |
'selectors' => [ |
| 234 |
'{{WRAPPER}} .jltma-caldera-form-heading' => 'text-align: {{VALUE}};', |
| 235 |
], |
| 236 |
'condition' => [ |
| 237 |
'custom_title_description' => 'yes', |
| 238 |
], |
| 239 |
] |
| 240 |
); |
| 241 |
|
| 242 |
$this->add_control( |
| 243 |
'title_heading', |
| 244 |
[ |
| 245 |
'label' => __('Title', 'master-addons' ), |
| 246 |
'type' => Controls_Manager::HEADING, |
| 247 |
'separator' => 'before', |
| 248 |
'condition' => [ |
| 249 |
'custom_title_description' => 'yes', |
| 250 |
], |
| 251 |
] |
| 252 |
); |
| 253 |
|
| 254 |
$this->add_control( |
| 255 |
'form_title_text_color', |
| 256 |
[ |
| 257 |
'label' => __('Text Color', 'master-addons' ), |
| 258 |
'type' => Controls_Manager::COLOR, |
| 259 |
'default' => '', |
| 260 |
'selectors' => [ |
| 261 |
'{{WRAPPER}} .jltma-contact-form-title' => 'color: {{VALUE}}', |
| 262 |
], |
| 263 |
'condition' => [ |
| 264 |
'custom_title_description' => 'yes', |
| 265 |
], |
| 266 |
] |
| 267 |
); |
| 268 |
|
| 269 |
$this->add_group_control( |
| 270 |
Group_Control_Typography::get_type(), |
| 271 |
[ |
| 272 |
'name' => 'form_title_typography', |
| 273 |
'label' => __('Typography', 'master-addons' ), |
| 274 |
'selector' => '{{WRAPPER}} .jltma-contact-form-title', |
| 275 |
'global' => [ |
| 276 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 277 |
], |
| 278 |
'condition' => [ |
| 279 |
'custom_title_description' => 'yes', |
| 280 |
], |
| 281 |
] |
| 282 |
); |
| 283 |
|
| 284 |
$this->add_responsive_control( |
| 285 |
'form_title_margin', |
| 286 |
[ |
| 287 |
'label' => __('Margin', 'master-addons' ), |
| 288 |
'type' => Controls_Manager::DIMENSIONS, |
| 289 |
'size_units' => ['px', 'em', '%'], |
| 290 |
'allowed_dimensions' => 'vertical', |
| 291 |
'placeholder' => [ |
| 292 |
'top' => '', |
| 293 |
'right' => 'auto', |
| 294 |
'bottom' => '', |
| 295 |
'left' => 'auto', |
| 296 |
], |
| 297 |
'selectors' => [ |
| 298 |
'{{WRAPPER}} .jltma-contact-form-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 299 |
], |
| 300 |
'condition' => [ |
| 301 |
'custom_title_description' => 'yes', |
| 302 |
], |
| 303 |
] |
| 304 |
); |
| 305 |
|
| 306 |
$this->add_control( |
| 307 |
'description_heading', |
| 308 |
[ |
| 309 |
'label' => __('Description', 'master-addons' ), |
| 310 |
'type' => Controls_Manager::HEADING, |
| 311 |
'separator' => 'before', |
| 312 |
'condition' => [ |
| 313 |
'custom_title_description' => 'yes', |
| 314 |
], |
| 315 |
] |
| 316 |
); |
| 317 |
|
| 318 |
$this->add_control( |
| 319 |
'form_description_text_color', |
| 320 |
[ |
| 321 |
'label' => __('Text Color', 'master-addons' ), |
| 322 |
'type' => Controls_Manager::COLOR, |
| 323 |
'default' => '', |
| 324 |
'selectors' => [ |
| 325 |
'{{WRAPPER}} .jltma-contact-form-description' => 'color: {{VALUE}}', |
| 326 |
], |
| 327 |
'condition' => [ |
| 328 |
'custom_title_description' => 'yes', |
| 329 |
], |
| 330 |
] |
| 331 |
); |
| 332 |
|
| 333 |
$this->add_group_control( |
| 334 |
Group_Control_Typography::get_type(), |
| 335 |
[ |
| 336 |
'name' => 'form_description_typography', |
| 337 |
'label' => __('Typography', 'master-addons' ), |
| 338 |
'global' => [ |
| 339 |
'default' => Global_Typography::TYPOGRAPHY_ACCENT, |
| 340 |
], |
| 341 |
'selector' => '{{WRAPPER}} .jltma-contact-form-description', |
| 342 |
'condition' => [ |
| 343 |
'custom_title_description' => 'yes', |
| 344 |
], |
| 345 |
] |
| 346 |
); |
| 347 |
|
| 348 |
$this->add_responsive_control( |
| 349 |
'form_description_margin', |
| 350 |
[ |
| 351 |
'label' => __('Margin', 'master-addons' ), |
| 352 |
'type' => Controls_Manager::DIMENSIONS, |
| 353 |
'size_units' => ['px', 'em', '%'], |
| 354 |
'allowed_dimensions' => 'vertical', |
| 355 |
'placeholder' => [ |
| 356 |
'top' => '', |
| 357 |
'right' => 'auto', |
| 358 |
'bottom' => '', |
| 359 |
'left' => 'auto', |
| 360 |
], |
| 361 |
'selectors' => [ |
| 362 |
'{{WRAPPER}} .jltma-contact-form-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 363 |
], |
| 364 |
'condition' => [ |
| 365 |
'custom_title_description' => 'yes', |
| 366 |
], |
| 367 |
] |
| 368 |
); |
| 369 |
|
| 370 |
$this->end_controls_section(); |
| 371 |
|
| 372 |
/** |
| 373 |
* Style Tab: Labels |
| 374 |
* ------------------------------------------------- |
| 375 |
*/ |
| 376 |
$this->start_controls_section( |
| 377 |
'section_label_style', |
| 378 |
[ |
| 379 |
'label' => __('Labels', 'master-addons' ), |
| 380 |
'tab' => Controls_Manager::TAB_STYLE, |
| 381 |
] |
| 382 |
); |
| 383 |
|
| 384 |
$this->add_control( |
| 385 |
'text_color_label', |
| 386 |
[ |
| 387 |
'label' => __('Text Color', 'master-addons' ), |
| 388 |
'type' => Controls_Manager::COLOR, |
| 389 |
'selectors' => [ |
| 390 |
'{{WRAPPER}} .jltma-caldera-form .form-group label' => 'color: {{VALUE}}', |
| 391 |
], |
| 392 |
] |
| 393 |
); |
| 394 |
|
| 395 |
$this->add_group_control( |
| 396 |
Group_Control_Typography::get_type(), |
| 397 |
[ |
| 398 |
'name' => 'typography_label', |
| 399 |
'label' => __('Typography', 'master-addons' ), |
| 400 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .form-group label', |
| 401 |
] |
| 402 |
); |
| 403 |
|
| 404 |
$this->end_controls_section(); |
| 405 |
|
| 406 |
/** |
| 407 |
* Style Tab: Input & Textarea |
| 408 |
* ------------------------------------------------- |
| 409 |
*/ |
| 410 |
$this->start_controls_section( |
| 411 |
'section_fields_style', |
| 412 |
[ |
| 413 |
'label' => __('Input & Textarea', 'master-addons' ), |
| 414 |
'tab' => Controls_Manager::TAB_STYLE, |
| 415 |
] |
| 416 |
); |
| 417 |
|
| 418 |
$this->add_responsive_control( |
| 419 |
'input_alignment', |
| 420 |
[ |
| 421 |
'label' => __('Alignment', 'master-addons' ), |
| 422 |
'type' => Controls_Manager::CHOOSE, |
| 423 |
'options' => Helper::jltma_content_alignment(), |
| 424 |
'default' => '', |
| 425 |
'selectors' => [ |
| 426 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select' => 'text-align: {{VALUE}};', |
| 427 |
], |
| 428 |
] |
| 429 |
); |
| 430 |
|
| 431 |
$this->start_controls_tabs('tabs_fields_style'); |
| 432 |
|
| 433 |
$this->start_controls_tab( |
| 434 |
'tab_fields_normal', |
| 435 |
[ |
| 436 |
'label' => __('Normal', 'master-addons' ), |
| 437 |
] |
| 438 |
); |
| 439 |
|
| 440 |
$this->add_control( |
| 441 |
'field_bg_color', |
| 442 |
[ |
| 443 |
'label' => __('Background Color', 'master-addons' ), |
| 444 |
'type' => Controls_Manager::COLOR, |
| 445 |
'default' => '', |
| 446 |
'selectors' => [ |
| 447 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select' => 'background-color: {{VALUE}}', |
| 448 |
], |
| 449 |
] |
| 450 |
); |
| 451 |
|
| 452 |
$this->add_control( |
| 453 |
'field_text_color', |
| 454 |
[ |
| 455 |
'label' => __('Text Color', 'master-addons' ), |
| 456 |
'type' => Controls_Manager::COLOR, |
| 457 |
'default' => '', |
| 458 |
'selectors' => [ |
| 459 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select' => 'color: {{VALUE}}', |
| 460 |
], |
| 461 |
] |
| 462 |
); |
| 463 |
|
| 464 |
$this->add_group_control( |
| 465 |
Group_Control_Border::get_type(), |
| 466 |
[ |
| 467 |
'name' => 'field_border', |
| 468 |
'label' => __('Border', 'master-addons' ), |
| 469 |
'placeholder' => '1px', |
| 470 |
'default' => '1px', |
| 471 |
'selector' => '{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select', |
| 472 |
'separator' => 'before', |
| 473 |
] |
| 474 |
); |
| 475 |
|
| 476 |
$this->add_control( |
| 477 |
'field_radius', |
| 478 |
[ |
| 479 |
'label' => __('Border Radius', 'master-addons' ), |
| 480 |
'type' => Controls_Manager::DIMENSIONS, |
| 481 |
'size_units' => ['px', 'em', '%'], |
| 482 |
'selectors' => [ |
| 483 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 484 |
], |
| 485 |
] |
| 486 |
); |
| 487 |
|
| 488 |
$this->add_responsive_control( |
| 489 |
'field_text_indent', |
| 490 |
[ |
| 491 |
'label' => __('Text Indent', 'master-addons' ), |
| 492 |
'type' => Controls_Manager::SLIDER, |
| 493 |
'range' => [ |
| 494 |
'px' => [ |
| 495 |
'min' => 0, |
| 496 |
'max' => 60, |
| 497 |
'step' => 1, |
| 498 |
], |
| 499 |
'%' => [ |
| 500 |
'min' => 0, |
| 501 |
'max' => 30, |
| 502 |
'step' => 1, |
| 503 |
], |
| 504 |
], |
| 505 |
'size_units' => ['px', 'em', '%'], |
| 506 |
'selectors' => [ |
| 507 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select' => 'text-indent: {{SIZE}}{{UNIT}}', |
| 508 |
], |
| 509 |
'separator' => 'before' |
| 510 |
] |
| 511 |
); |
| 512 |
|
| 513 |
$this->add_responsive_control( |
| 514 |
'input_width', |
| 515 |
[ |
| 516 |
'label' => __('Input Width', 'master-addons' ), |
| 517 |
'type' => Controls_Manager::SLIDER, |
| 518 |
'range' => [ |
| 519 |
'px' => [ |
| 520 |
'min' => 0, |
| 521 |
'max' => 1200, |
| 522 |
'step' => 1, |
| 523 |
], |
| 524 |
], |
| 525 |
'size_units' => ['px', 'em', '%'], |
| 526 |
'selectors' => [ |
| 527 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group select' => 'width: {{SIZE}}{{UNIT}}', |
| 528 |
], |
| 529 |
] |
| 530 |
); |
| 531 |
|
| 532 |
$this->add_responsive_control( |
| 533 |
'input_height', |
| 534 |
[ |
| 535 |
'label' => __('Input Height', 'master-addons' ), |
| 536 |
'type' => Controls_Manager::SLIDER, |
| 537 |
'range' => [ |
| 538 |
'px' => [ |
| 539 |
'min' => 0, |
| 540 |
'max' => 80, |
| 541 |
'step' => 1, |
| 542 |
], |
| 543 |
], |
| 544 |
'size_units' => ['px', 'em', '%'], |
| 545 |
'selectors' => [ |
| 546 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group select' => 'height: {{SIZE}}{{UNIT}}', |
| 547 |
], |
| 548 |
] |
| 549 |
); |
| 550 |
|
| 551 |
$this->add_responsive_control( |
| 552 |
'textarea_width', |
| 553 |
[ |
| 554 |
'label' => __('Textarea Width', 'master-addons' ), |
| 555 |
'type' => Controls_Manager::SLIDER, |
| 556 |
'range' => [ |
| 557 |
'px' => [ |
| 558 |
'min' => 0, |
| 559 |
'max' => 1200, |
| 560 |
'step' => 1, |
| 561 |
], |
| 562 |
], |
| 563 |
'size_units' => ['px', 'em', '%'], |
| 564 |
'selectors' => [ |
| 565 |
'{{WRAPPER}} .jltma-caldera-form .form-group textarea' => 'width: {{SIZE}}{{UNIT}}', |
| 566 |
], |
| 567 |
] |
| 568 |
); |
| 569 |
|
| 570 |
$this->add_responsive_control( |
| 571 |
'textarea_height', |
| 572 |
[ |
| 573 |
'label' => __('Textarea Height', 'master-addons' ), |
| 574 |
'type' => Controls_Manager::SLIDER, |
| 575 |
'range' => [ |
| 576 |
'px' => [ |
| 577 |
'min' => 0, |
| 578 |
'max' => 400, |
| 579 |
'step' => 1, |
| 580 |
], |
| 581 |
], |
| 582 |
'size_units' => ['px', 'em', '%'], |
| 583 |
'selectors' => [ |
| 584 |
'{{WRAPPER}} .jltma-caldera-form .form-group textarea' => 'height: {{SIZE}}{{UNIT}}', |
| 585 |
], |
| 586 |
] |
| 587 |
); |
| 588 |
|
| 589 |
$this->add_responsive_control( |
| 590 |
'field_padding', |
| 591 |
[ |
| 592 |
'label' => __('Padding', 'master-addons' ), |
| 593 |
'type' => Controls_Manager::DIMENSIONS, |
| 594 |
'size_units' => ['px', 'em', '%'], |
| 595 |
'selectors' => [ |
| 596 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 597 |
], |
| 598 |
] |
| 599 |
); |
| 600 |
|
| 601 |
$this->add_responsive_control( |
| 602 |
'field_spacing', |
| 603 |
[ |
| 604 |
'label' => __('Spacing', 'master-addons' ), |
| 605 |
'type' => Controls_Manager::SLIDER, |
| 606 |
'range' => [ |
| 607 |
'px' => [ |
| 608 |
'min' => 0, |
| 609 |
'max' => 100, |
| 610 |
'step' => 1, |
| 611 |
], |
| 612 |
], |
| 613 |
'size_units' => ['px', 'em', '%'], |
| 614 |
'selectors' => [ |
| 615 |
'{{WRAPPER}} .jltma-caldera-form .form-group' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 616 |
], |
| 617 |
] |
| 618 |
); |
| 619 |
|
| 620 |
$this->add_group_control( |
| 621 |
Group_Control_Typography::get_type(), |
| 622 |
[ |
| 623 |
'name' => 'field_typography', |
| 624 |
'label' => __('Typography', 'master-addons' ), |
| 625 |
'selector' => '{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select', |
| 626 |
'separator' => 'before', |
| 627 |
] |
| 628 |
); |
| 629 |
|
| 630 |
$this->add_group_control( |
| 631 |
Group_Control_Box_Shadow::get_type(), |
| 632 |
[ |
| 633 |
'name' => 'field_box_shadow', |
| 634 |
'selector' => '{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .form-group textarea, {{WRAPPER}} .jltma-caldera-form .form-group select', |
| 635 |
'separator' => 'before', |
| 636 |
] |
| 637 |
); |
| 638 |
|
| 639 |
$this->end_controls_tab(); |
| 640 |
|
| 641 |
$this->start_controls_tab( |
| 642 |
'tab_fields_focus', |
| 643 |
[ |
| 644 |
'label' => __('Focus', 'master-addons' ), |
| 645 |
] |
| 646 |
); |
| 647 |
|
| 648 |
$this->add_control( |
| 649 |
'field_bg_color_focus', |
| 650 |
[ |
| 651 |
'label' => __('Background Color', 'master-addons' ), |
| 652 |
'type' => Controls_Manager::COLOR, |
| 653 |
'default' => '', |
| 654 |
'selectors' => [ |
| 655 |
'{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):focus, {{WRAPPER}} .jltma-caldera-form .form-group textarea:focus' => 'background-color: {{VALUE}}', |
| 656 |
], |
| 657 |
] |
| 658 |
); |
| 659 |
|
| 660 |
$this->add_group_control( |
| 661 |
Group_Control_Border::get_type(), |
| 662 |
[ |
| 663 |
'name' => 'focus_input_border', |
| 664 |
'label' => __('Border', 'master-addons' ), |
| 665 |
'placeholder' => '1px', |
| 666 |
'default' => '1px', |
| 667 |
'selector' => '{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):focus, {{WRAPPER}} .jltma-caldera-form .form-group textarea:focus', |
| 668 |
] |
| 669 |
); |
| 670 |
|
| 671 |
$this->add_group_control( |
| 672 |
Group_Control_Box_Shadow::get_type(), |
| 673 |
[ |
| 674 |
'name' => 'focus_box_shadow', |
| 675 |
'selector' => '{{WRAPPER}} .jltma-caldera-form input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):focus, {{WRAPPER}} .jltma-caldera-form .form-group textarea:focus', |
| 676 |
'separator' => 'before', |
| 677 |
] |
| 678 |
); |
| 679 |
|
| 680 |
$this->end_controls_tab(); |
| 681 |
|
| 682 |
$this->end_controls_tabs(); |
| 683 |
|
| 684 |
$this->end_controls_section(); |
| 685 |
|
| 686 |
/** |
| 687 |
* Style Tab: Field Description |
| 688 |
* ------------------------------------------------- |
| 689 |
*/ |
| 690 |
$this->start_controls_section( |
| 691 |
'section_field_description_style', |
| 692 |
[ |
| 693 |
'label' => __('Field Description', 'master-addons' ), |
| 694 |
'tab' => Controls_Manager::TAB_STYLE, |
| 695 |
] |
| 696 |
); |
| 697 |
|
| 698 |
$this->add_control( |
| 699 |
'field_description_text_color', |
| 700 |
[ |
| 701 |
'label' => __('Text Color', 'master-addons' ), |
| 702 |
'type' => Controls_Manager::COLOR, |
| 703 |
'selectors' => [ |
| 704 |
'{{WRAPPER}} .jltma-caldera-form .help-block' => 'color: {{VALUE}}', |
| 705 |
], |
| 706 |
] |
| 707 |
); |
| 708 |
|
| 709 |
$this->add_group_control( |
| 710 |
Group_Control_Typography::get_type(), |
| 711 |
[ |
| 712 |
'name' => 'field_description_typography', |
| 713 |
'label' => __('Typography', 'master-addons' ), |
| 714 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .help-block', |
| 715 |
] |
| 716 |
); |
| 717 |
|
| 718 |
$this->add_responsive_control( |
| 719 |
'field_description_spacing', |
| 720 |
[ |
| 721 |
'label' => __('Spacing', 'master-addons' ), |
| 722 |
'type' => Controls_Manager::SLIDER, |
| 723 |
'range' => [ |
| 724 |
'px' => [ |
| 725 |
'min' => 0, |
| 726 |
'max' => 100, |
| 727 |
'step' => 1, |
| 728 |
], |
| 729 |
], |
| 730 |
'size_units' => ['px', 'em', '%'], |
| 731 |
'selectors' => [ |
| 732 |
'{{WRAPPER}} .jltma-caldera-form .help-block' => 'padding-top: {{SIZE}}{{UNIT}}', |
| 733 |
], |
| 734 |
] |
| 735 |
); |
| 736 |
|
| 737 |
$this->end_controls_section(); |
| 738 |
|
| 739 |
/** |
| 740 |
* Style Tab: Placeholder |
| 741 |
* ------------------------------------------------- |
| 742 |
*/ |
| 743 |
$this->start_controls_section( |
| 744 |
'section_placeholder_style', |
| 745 |
[ |
| 746 |
'label' => __('Placeholder', 'master-addons' ), |
| 747 |
'tab' => Controls_Manager::TAB_STYLE, |
| 748 |
'condition' => [ |
| 749 |
'placeholder_switch' => 'yes', |
| 750 |
], |
| 751 |
] |
| 752 |
); |
| 753 |
|
| 754 |
$this->add_control( |
| 755 |
'text_color_placeholder', |
| 756 |
[ |
| 757 |
'label' => __('Text Color', 'master-addons' ), |
| 758 |
'type' => Controls_Manager::COLOR, |
| 759 |
'selectors' => [ |
| 760 |
'{{WRAPPER}} .jltma-caldera-form .form-group input::-webkit-input-placeholder, {{WRAPPER}} .jltma-caldera-form .form-group textarea::-webkit-input-placeholder' => 'color: {{VALUE}}', |
| 761 |
], |
| 762 |
'condition' => [ |
| 763 |
'placeholder_switch' => 'yes', |
| 764 |
], |
| 765 |
] |
| 766 |
); |
| 767 |
|
| 768 |
$this->end_controls_section(); |
| 769 |
|
| 770 |
/** |
| 771 |
* Style Tab: Radio & Checkbox |
| 772 |
* ------------------------------------------------- |
| 773 |
*/ |
| 774 |
$this->start_controls_section( |
| 775 |
'section_radio_checkbox_style', |
| 776 |
[ |
| 777 |
'label' => __('Radio & Checkbox', 'master-addons' ), |
| 778 |
'tab' => Controls_Manager::TAB_STYLE, |
| 779 |
] |
| 780 |
); |
| 781 |
|
| 782 |
$this->add_control( |
| 783 |
'custom_radio_checkbox', |
| 784 |
[ |
| 785 |
'label' => __('Custom Styles', 'master-addons' ), |
| 786 |
'type' => Controls_Manager::SWITCHER, |
| 787 |
'label_on' => __('Yes', 'master-addons' ), |
| 788 |
'label_off' => __('No', 'master-addons' ), |
| 789 |
'return_value' => 'yes', |
| 790 |
] |
| 791 |
); |
| 792 |
|
| 793 |
$this->add_responsive_control( |
| 794 |
'radio_checkbox_size', |
| 795 |
[ |
| 796 |
'label' => __('Size', 'master-addons' ), |
| 797 |
'type' => Controls_Manager::SLIDER, |
| 798 |
'default' => [ |
| 799 |
'size' => '15', |
| 800 |
'unit' => 'px' |
| 801 |
], |
| 802 |
'range' => [ |
| 803 |
'px' => [ |
| 804 |
'min' => 0, |
| 805 |
'max' => 80, |
| 806 |
'step' => 1, |
| 807 |
], |
| 808 |
], |
| 809 |
'size_units' => ['px', 'em', '%'], |
| 810 |
'selectors' => [ |
| 811 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}', |
| 812 |
], |
| 813 |
'condition' => [ |
| 814 |
'custom_radio_checkbox' => 'yes', |
| 815 |
], |
| 816 |
] |
| 817 |
); |
| 818 |
|
| 819 |
$this->start_controls_tabs('tabs_radio_checkbox_style'); |
| 820 |
|
| 821 |
$this->start_controls_tab( |
| 822 |
'radio_checkbox_normal', |
| 823 |
[ |
| 824 |
'label' => __('Normal', 'master-addons' ), |
| 825 |
'condition' => [ |
| 826 |
'custom_radio_checkbox' => 'yes', |
| 827 |
], |
| 828 |
] |
| 829 |
); |
| 830 |
|
| 831 |
$this->add_control( |
| 832 |
'radio_checkbox_color', |
| 833 |
[ |
| 834 |
'label' => __('Color', 'master-addons' ), |
| 835 |
'type' => Controls_Manager::COLOR, |
| 836 |
'default' => '', |
| 837 |
'selectors' => [ |
| 838 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'background: {{VALUE}}', |
| 839 |
], |
| 840 |
'condition' => [ |
| 841 |
'custom_radio_checkbox' => 'yes', |
| 842 |
], |
| 843 |
] |
| 844 |
); |
| 845 |
|
| 846 |
$this->add_responsive_control( |
| 847 |
'checkbox_border_width', |
| 848 |
[ |
| 849 |
'label' => __('Border Width', 'master-addons' ), |
| 850 |
'type' => Controls_Manager::SLIDER, |
| 851 |
'range' => [ |
| 852 |
'px' => [ |
| 853 |
'min' => 0, |
| 854 |
'max' => 15, |
| 855 |
'step' => 1, |
| 856 |
], |
| 857 |
], |
| 858 |
'size_units' => ['px'], |
| 859 |
'selectors' => [ |
| 860 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'border-width: {{SIZE}}{{UNIT}}', |
| 861 |
], |
| 862 |
'condition' => [ |
| 863 |
'custom_radio_checkbox' => 'yes', |
| 864 |
], |
| 865 |
] |
| 866 |
); |
| 867 |
|
| 868 |
$this->add_control( |
| 869 |
'checkbox_border_color', |
| 870 |
[ |
| 871 |
'label' => __('Border Color', 'master-addons' ), |
| 872 |
'type' => Controls_Manager::COLOR, |
| 873 |
'default' => '', |
| 874 |
'selectors' => [ |
| 875 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'border-color: {{VALUE}}', |
| 876 |
], |
| 877 |
'condition' => [ |
| 878 |
'custom_radio_checkbox' => 'yes', |
| 879 |
], |
| 880 |
] |
| 881 |
); |
| 882 |
|
| 883 |
$this->add_control( |
| 884 |
'checkbox_heading', |
| 885 |
[ |
| 886 |
'label' => __('Checkbox', 'master-addons' ), |
| 887 |
'type' => Controls_Manager::HEADING, |
| 888 |
'condition' => [ |
| 889 |
'custom_radio_checkbox' => 'yes', |
| 890 |
], |
| 891 |
] |
| 892 |
); |
| 893 |
|
| 894 |
$this->add_control( |
| 895 |
'checkbox_border_radius', |
| 896 |
[ |
| 897 |
'label' => __('Border Radius', 'master-addons' ), |
| 898 |
'type' => Controls_Manager::DIMENSIONS, |
| 899 |
'size_units' => ['px', 'em', '%'], |
| 900 |
'selectors' => [ |
| 901 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"]:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 902 |
], |
| 903 |
'condition' => [ |
| 904 |
'custom_radio_checkbox' => 'yes', |
| 905 |
], |
| 906 |
] |
| 907 |
); |
| 908 |
|
| 909 |
$this->add_control( |
| 910 |
'radio_heading', |
| 911 |
[ |
| 912 |
'label' => __('Radio Buttons', 'master-addons' ), |
| 913 |
'type' => Controls_Manager::HEADING, |
| 914 |
'condition' => [ |
| 915 |
'custom_radio_checkbox' => 'yes', |
| 916 |
], |
| 917 |
] |
| 918 |
); |
| 919 |
|
| 920 |
$this->add_control( |
| 921 |
'radio_border_radius', |
| 922 |
[ |
| 923 |
'label' => __('Border Radius', 'master-addons' ), |
| 924 |
'type' => Controls_Manager::DIMENSIONS, |
| 925 |
'size_units' => ['px', 'em', '%'], |
| 926 |
'selectors' => [ |
| 927 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 928 |
], |
| 929 |
'condition' => [ |
| 930 |
'custom_radio_checkbox' => 'yes', |
| 931 |
], |
| 932 |
] |
| 933 |
); |
| 934 |
|
| 935 |
$this->end_controls_tab(); |
| 936 |
|
| 937 |
$this->start_controls_tab( |
| 938 |
'radio_checkbox_checked', |
| 939 |
[ |
| 940 |
'label' => __('Checked', 'master-addons' ), |
| 941 |
'condition' => [ |
| 942 |
'custom_radio_checkbox' => 'yes', |
| 943 |
], |
| 944 |
] |
| 945 |
); |
| 946 |
|
| 947 |
$this->add_control( |
| 948 |
'radio_checkbox_color_checked', |
| 949 |
[ |
| 950 |
'label' => __('Color', 'master-addons' ), |
| 951 |
'type' => Controls_Manager::COLOR, |
| 952 |
'default' => '', |
| 953 |
'selectors' => [ |
| 954 |
'{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"]:checked:before, {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]:checked:before' => 'background: {{VALUE}}', |
| 955 |
], |
| 956 |
'condition' => [ |
| 957 |
'custom_radio_checkbox' => 'yes', |
| 958 |
], |
| 959 |
] |
| 960 |
); |
| 961 |
|
| 962 |
$this->end_controls_tab(); |
| 963 |
|
| 964 |
$this->end_controls_tabs(); |
| 965 |
|
| 966 |
$this->end_controls_section(); |
| 967 |
|
| 968 |
/** |
| 969 |
* Style Tab: Submit Button |
| 970 |
* ------------------------------------------------- |
| 971 |
*/ |
| 972 |
$this->start_controls_section( |
| 973 |
'section_submit_button_style', |
| 974 |
[ |
| 975 |
'label' => __('Submit Button', 'master-addons' ), |
| 976 |
'tab' => Controls_Manager::TAB_STYLE, |
| 977 |
] |
| 978 |
); |
| 979 |
|
| 980 |
$this->add_responsive_control( |
| 981 |
'button_align', |
| 982 |
[ |
| 983 |
'label' => __('Alignment', 'master-addons' ), |
| 984 |
'type' => Controls_Manager::CHOOSE, |
| 985 |
'options' => [ |
| 986 |
'left' => [ |
| 987 |
'title' => __('Left', 'master-addons' ), |
| 988 |
'icon' => 'eicon-h-align-left', |
| 989 |
], |
| 990 |
'center' => [ |
| 991 |
'title' => __('Center', 'master-addons' ), |
| 992 |
'icon' => 'eicon-h-align-center', |
| 993 |
], |
| 994 |
'right' => [ |
| 995 |
'title' => __('Right', 'master-addons' ), |
| 996 |
'icon' => 'eicon-h-align-right', |
| 997 |
], |
| 998 |
], |
| 999 |
'default' => '', |
| 1000 |
'prefix_class' => 'jltma-caldera-form-button-', |
| 1001 |
'condition' => [ |
| 1002 |
'button_width_type' => 'custom', |
| 1003 |
], |
| 1004 |
] |
| 1005 |
); |
| 1006 |
|
| 1007 |
$this->add_control( |
| 1008 |
'button_width_type', |
| 1009 |
[ |
| 1010 |
'label' => __('Width', 'master-addons' ), |
| 1011 |
'type' => Controls_Manager::SELECT, |
| 1012 |
'default' => 'custom', |
| 1013 |
'options' => [ |
| 1014 |
'full-width' => __('Full Width', 'master-addons' ), |
| 1015 |
'custom' => __('Custom', 'master-addons' ), |
| 1016 |
], |
| 1017 |
'prefix_class' => 'jltma-caldera-form-button-', |
| 1018 |
] |
| 1019 |
); |
| 1020 |
|
| 1021 |
$this->add_responsive_control( |
| 1022 |
'button_width', |
| 1023 |
[ |
| 1024 |
'label' => __('Width', 'master-addons' ), |
| 1025 |
'type' => Controls_Manager::SLIDER, |
| 1026 |
'default' => [ |
| 1027 |
'size' => '135', |
| 1028 |
'unit' => 'px' |
| 1029 |
], |
| 1030 |
'range' => [ |
| 1031 |
'px' => [ |
| 1032 |
'min' => 0, |
| 1033 |
'max' => 1200, |
| 1034 |
'step' => 1, |
| 1035 |
], |
| 1036 |
], |
| 1037 |
'size_units' => ['px', '%'], |
| 1038 |
'selectors' => [ |
| 1039 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]' => 'width: {{SIZE}}{{UNIT}}', |
| 1040 |
], |
| 1041 |
'condition' => [ |
| 1042 |
'button_width_type' => 'custom', |
| 1043 |
], |
| 1044 |
] |
| 1045 |
); |
| 1046 |
|
| 1047 |
$this->start_controls_tabs('tabs_button_style'); |
| 1048 |
|
| 1049 |
$this->start_controls_tab( |
| 1050 |
'tab_button_normal', |
| 1051 |
[ |
| 1052 |
'label' => __('Normal', 'master-addons' ), |
| 1053 |
] |
| 1054 |
); |
| 1055 |
|
| 1056 |
$this->add_control( |
| 1057 |
'button_bg_color_normal', |
| 1058 |
[ |
| 1059 |
'label' => __('Background Color', 'master-addons' ), |
| 1060 |
'type' => Controls_Manager::COLOR, |
| 1061 |
'default' => '', |
| 1062 |
'selectors' => [ |
| 1063 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]' => 'background-color: {{VALUE}}', |
| 1064 |
], |
| 1065 |
] |
| 1066 |
); |
| 1067 |
|
| 1068 |
$this->add_control( |
| 1069 |
'button_text_color_normal', |
| 1070 |
[ |
| 1071 |
'label' => __('Text Color', 'master-addons' ), |
| 1072 |
'type' => Controls_Manager::COLOR, |
| 1073 |
'default' => '', |
| 1074 |
'selectors' => [ |
| 1075 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]' => 'color: {{VALUE}}', |
| 1076 |
], |
| 1077 |
] |
| 1078 |
); |
| 1079 |
|
| 1080 |
$this->add_group_control( |
| 1081 |
Group_Control_Border::get_type(), |
| 1082 |
[ |
| 1083 |
'name' => 'button_border_normal', |
| 1084 |
'label' => __('Border', 'master-addons' ), |
| 1085 |
'placeholder' => '1px', |
| 1086 |
'default' => '1px', |
| 1087 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]', |
| 1088 |
] |
| 1089 |
); |
| 1090 |
|
| 1091 |
$this->add_control( |
| 1092 |
'button_border_radius', |
| 1093 |
[ |
| 1094 |
'label' => __('Border Radius', 'master-addons' ), |
| 1095 |
'type' => Controls_Manager::DIMENSIONS, |
| 1096 |
'size_units' => ['px', 'em', '%'], |
| 1097 |
'selectors' => [ |
| 1098 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1099 |
], |
| 1100 |
] |
| 1101 |
); |
| 1102 |
|
| 1103 |
$this->add_responsive_control( |
| 1104 |
'button_padding', |
| 1105 |
[ |
| 1106 |
'label' => __('Padding', 'master-addons' ), |
| 1107 |
'type' => Controls_Manager::DIMENSIONS, |
| 1108 |
'size_units' => ['px', 'em', '%'], |
| 1109 |
'selectors' => [ |
| 1110 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1111 |
], |
| 1112 |
] |
| 1113 |
); |
| 1114 |
|
| 1115 |
$this->add_responsive_control( |
| 1116 |
'button_margin', |
| 1117 |
[ |
| 1118 |
'label' => __('Margin Top', 'master-addons' ), |
| 1119 |
'type' => Controls_Manager::SLIDER, |
| 1120 |
'range' => [ |
| 1121 |
'px' => [ |
| 1122 |
'min' => 0, |
| 1123 |
'max' => 100, |
| 1124 |
'step' => 1, |
| 1125 |
], |
| 1126 |
], |
| 1127 |
'size_units' => ['px', 'em', '%'], |
| 1128 |
'selectors' => [ |
| 1129 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]' => 'margin-top: {{SIZE}}{{UNIT}}', |
| 1130 |
], |
| 1131 |
] |
| 1132 |
); |
| 1133 |
|
| 1134 |
$this->add_group_control( |
| 1135 |
Group_Control_Typography::get_type(), |
| 1136 |
[ |
| 1137 |
'name' => 'button_typography', |
| 1138 |
'label' => __('Typography', 'master-addons' ), |
| 1139 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]', |
| 1140 |
'separator' => 'before', |
| 1141 |
] |
| 1142 |
); |
| 1143 |
|
| 1144 |
$this->add_group_control( |
| 1145 |
Group_Control_Box_Shadow::get_type(), |
| 1146 |
[ |
| 1147 |
'name' => 'button_box_shadow', |
| 1148 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"], {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]', |
| 1149 |
'separator' => 'before', |
| 1150 |
] |
| 1151 |
); |
| 1152 |
|
| 1153 |
$this->end_controls_tab(); |
| 1154 |
|
| 1155 |
$this->start_controls_tab( |
| 1156 |
'tab_button_hover', |
| 1157 |
[ |
| 1158 |
'label' => __('Hover', 'master-addons' ), |
| 1159 |
] |
| 1160 |
); |
| 1161 |
|
| 1162 |
$this->add_control( |
| 1163 |
'button_bg_color_hover', |
| 1164 |
[ |
| 1165 |
'label' => __('Background Color', 'master-addons' ), |
| 1166 |
'type' => Controls_Manager::COLOR, |
| 1167 |
'default' => '', |
| 1168 |
'selectors' => [ |
| 1169 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"]:hover, {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]:hover' => 'background-color: {{VALUE}}', |
| 1170 |
], |
| 1171 |
] |
| 1172 |
); |
| 1173 |
|
| 1174 |
$this->add_control( |
| 1175 |
'button_text_color_hover', |
| 1176 |
[ |
| 1177 |
'label' => __('Text Color', 'master-addons' ), |
| 1178 |
'type' => Controls_Manager::COLOR, |
| 1179 |
'default' => '', |
| 1180 |
'selectors' => [ |
| 1181 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"]:hover, {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]:hover' => 'color: {{VALUE}}', |
| 1182 |
], |
| 1183 |
] |
| 1184 |
); |
| 1185 |
|
| 1186 |
$this->add_control( |
| 1187 |
'button_border_color_hover', |
| 1188 |
[ |
| 1189 |
'label' => __('Border Color', 'master-addons' ), |
| 1190 |
'type' => Controls_Manager::COLOR, |
| 1191 |
'default' => '', |
| 1192 |
'selectors' => [ |
| 1193 |
'{{WRAPPER}} .jltma-caldera-form .form-group input[type="submit"]:hover, {{WRAPPER}} .jltma-caldera-form .form-group input[type="button"]:hover' => 'border-color: {{VALUE}}', |
| 1194 |
], |
| 1195 |
] |
| 1196 |
); |
| 1197 |
|
| 1198 |
$this->end_controls_tab(); |
| 1199 |
|
| 1200 |
$this->end_controls_tabs(); |
| 1201 |
|
| 1202 |
$this->end_controls_section(); |
| 1203 |
|
| 1204 |
/** |
| 1205 |
* Style Tab: Success Message |
| 1206 |
* ------------------------------------------------- |
| 1207 |
*/ |
| 1208 |
$this->start_controls_section( |
| 1209 |
'section_success_message_style', |
| 1210 |
[ |
| 1211 |
'label' => __('Success Message', 'master-addons' ), |
| 1212 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1213 |
] |
| 1214 |
); |
| 1215 |
|
| 1216 |
$this->add_control( |
| 1217 |
'success_message_bg_color', |
| 1218 |
[ |
| 1219 |
'label' => __('Background Color', 'master-addons' ), |
| 1220 |
'type' => Controls_Manager::COLOR, |
| 1221 |
'selectors' => [ |
| 1222 |
'{{WRAPPER}} .jltma-caldera-form .caldera-grid .alert-success' => 'background-color: {{VALUE}}', |
| 1223 |
], |
| 1224 |
] |
| 1225 |
); |
| 1226 |
|
| 1227 |
$this->add_control( |
| 1228 |
'success_message_text_color', |
| 1229 |
[ |
| 1230 |
'label' => __('Text Color', 'master-addons' ), |
| 1231 |
'type' => Controls_Manager::COLOR, |
| 1232 |
'selectors' => [ |
| 1233 |
'{{WRAPPER}} .jltma-caldera-form .caldera-grid .alert-success' => 'color: {{VALUE}}', |
| 1234 |
], |
| 1235 |
] |
| 1236 |
); |
| 1237 |
|
| 1238 |
$this->add_group_control( |
| 1239 |
Group_Control_Border::get_type(), |
| 1240 |
[ |
| 1241 |
'name' => 'success_message_border', |
| 1242 |
'label' => __('Border', 'master-addons' ), |
| 1243 |
'placeholder' => '1px', |
| 1244 |
'default' => '1px', |
| 1245 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .caldera-grid .alert-success', |
| 1246 |
] |
| 1247 |
); |
| 1248 |
|
| 1249 |
$this->add_group_control( |
| 1250 |
Group_Control_Typography::get_type(), |
| 1251 |
[ |
| 1252 |
'name' => 'success_message_typography', |
| 1253 |
'label' => __('Typography', 'master-addons' ), |
| 1254 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .caldera-grid .alert-success', |
| 1255 |
] |
| 1256 |
); |
| 1257 |
|
| 1258 |
$this->end_controls_section(); |
| 1259 |
|
| 1260 |
/** |
| 1261 |
* Style Tab: Errors |
| 1262 |
* ------------------------------------------------- |
| 1263 |
*/ |
| 1264 |
$this->start_controls_section( |
| 1265 |
'section_error_style', |
| 1266 |
[ |
| 1267 |
'label' => __('Errors', 'master-addons' ), |
| 1268 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1269 |
] |
| 1270 |
); |
| 1271 |
|
| 1272 |
$this->add_control( |
| 1273 |
'error_messages_heading', |
| 1274 |
[ |
| 1275 |
'label' => __('Error Messages', 'master-addons' ), |
| 1276 |
'type' => Controls_Manager::HEADING, |
| 1277 |
'condition' => [ |
| 1278 |
'error_messages' => 'show', |
| 1279 |
], |
| 1280 |
] |
| 1281 |
); |
| 1282 |
|
| 1283 |
$this->add_control( |
| 1284 |
'error_message_text_color', |
| 1285 |
[ |
| 1286 |
'label' => __('Color', 'master-addons' ), |
| 1287 |
'type' => Controls_Manager::COLOR, |
| 1288 |
'default' => '', |
| 1289 |
'selectors' => [ |
| 1290 |
'{{WRAPPER}} .jltma-caldera-form .has-error .help-block' => 'color: {{VALUE}}', |
| 1291 |
], |
| 1292 |
'condition' => [ |
| 1293 |
'error_messages' => 'show', |
| 1294 |
], |
| 1295 |
] |
| 1296 |
); |
| 1297 |
|
| 1298 |
$this->add_control( |
| 1299 |
'error_fields_heading', |
| 1300 |
[ |
| 1301 |
'label' => __('Error Fields', 'master-addons' ), |
| 1302 |
'type' => Controls_Manager::HEADING, |
| 1303 |
'separator' => 'before', |
| 1304 |
] |
| 1305 |
); |
| 1306 |
|
| 1307 |
$this->add_control( |
| 1308 |
'error_fields_label_color', |
| 1309 |
[ |
| 1310 |
'label' => __('Label Color', 'master-addons' ), |
| 1311 |
'type' => Controls_Manager::COLOR, |
| 1312 |
'default' => '', |
| 1313 |
'selectors' => [ |
| 1314 |
'{{WRAPPER}} .jltma-caldera-form .has-error .control-label' => 'color: {{VALUE}}', |
| 1315 |
], |
| 1316 |
] |
| 1317 |
); |
| 1318 |
|
| 1319 |
$this->add_group_control( |
| 1320 |
Group_Control_Border::get_type(), |
| 1321 |
[ |
| 1322 |
'name' => 'error_field_border', |
| 1323 |
'label' => __('Input Border', 'master-addons' ), |
| 1324 |
'placeholder' => '1px', |
| 1325 |
'default' => '1px', |
| 1326 |
'selector' => '{{WRAPPER}} .jltma-caldera-form .has-error input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-caldera-form .has-error textarea', |
| 1327 |
] |
| 1328 |
); |
| 1329 |
|
| 1330 |
$this->end_controls_section(); |
| 1331 |
} |
| 1332 |
|
| 1333 |
protected function render() |
| 1334 |
{ |
| 1335 |
|
| 1336 |
$settings = $this->get_settings(); |
| 1337 |
|
| 1338 |
// if Caldera Forms Missing |
| 1339 |
if (!class_exists('Caldera_Forms')) { |
| 1340 |
Helper::jltma_elementor_plugin_missing_notice(array( |
| 1341 |
'title' => esc_html__('Caldera Forms is Not Activated!', 'master-addons'), |
| 1342 |
'description' => esc_html__('To use this widget, please install and activate the "Caldera Forms" plugin.', 'master-addons'), |
| 1343 |
)); |
| 1344 |
return; |
| 1345 |
} |
| 1346 |
|
| 1347 |
$this->add_render_attribute( |
| 1348 |
'contact-form', |
| 1349 |
'class', |
| 1350 |
[ |
| 1351 |
'ma-cf', |
| 1352 |
'jltma-caldera-form', |
| 1353 |
'ma-cf', |
| 1354 |
'ma-cf-' . esc_attr($settings['ma_caldera_form_layout_style']) |
| 1355 |
] |
| 1356 |
); |
| 1357 |
|
| 1358 |
if ($settings['placeholder_switch'] != 'yes') { |
| 1359 |
$this->add_render_attribute('contact-form', 'class', 'placeholder-hide'); |
| 1360 |
} |
| 1361 |
|
| 1362 |
if ($settings['custom_title_description'] == 'yes') { |
| 1363 |
$this->add_render_attribute('contact-form', 'class', 'title-description-hide'); |
| 1364 |
} |
| 1365 |
|
| 1366 |
if ($settings['custom_radio_checkbox'] == 'yes') { |
| 1367 |
$this->add_render_attribute('contact-form', 'class', 'jltma-custom-radio-checkbox'); |
| 1368 |
} |
| 1369 |
|
| 1370 |
if (class_exists('Caldera_Forms')) { |
| 1371 |
if (!empty($settings['contact_form_list'])) { ?> |
| 1372 |
<div <?php echo $this->get_render_attribute_string('contact-form'); ?>> |
| 1373 |
<?php if ($settings['custom_title_description'] == 'yes') { ?> |
| 1374 |
<div class="jltma-caldera-form-heading"> |
| 1375 |
<?php if ($settings['form_title_custom'] != '') { ?> |
| 1376 |
<h3 class="jltma-contact-form-title jltma-caldera-form-title"> |
| 1377 |
<?php echo esc_attr($settings['form_title_custom']); ?> |
| 1378 |
</h3> |
| 1379 |
<?php } ?> |
| 1380 |
<?php if ($settings['form_description_custom'] != '') { ?> |
| 1381 |
<div class="jltma-contact-form-description jltma-caldera-form-description"> |
| 1382 |
<?php echo $this->parse_text_editor($settings['form_description_custom']); ?> |
| 1383 |
</div> |
| 1384 |
<?php } ?> |
| 1385 |
</div> |
| 1386 |
<?php } |
| 1387 |
echo do_shortcode('[caldera_form id="' . esc_html($settings['contact_form_list']) . '" ]'); |
| 1388 |
?> |
| 1389 |
</div> |
| 1390 |
<?php |
| 1391 |
} |
| 1392 |
} |
| 1393 |
} |
| 1394 |
|
| 1395 |
protected function content_template() |
| 1396 |
{ |
| 1397 |
} |
| 1398 |
} |
| 1399 |
|