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