| 1 |
<?php |
| 2 |
namespace UiCoreElements\Utils; |
| 3 |
|
| 4 |
use UiCoreElements\Helper; |
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Typography; |
| 7 |
use Elementor\Group_Control_Border; |
| 8 |
use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 |
use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 10 |
|
| 11 |
defined('ABSPATH') || exit(); |
| 12 |
|
| 13 |
/** |
| 14 |
* Register some Form Widgets controls and methods. |
| 15 |
*/ |
| 16 |
|
| 17 |
trait Form_Component { |
| 18 |
|
| 19 |
// Submission Controls |
| 20 |
function TRAIT_register_submit_email_controls($instance, $slug = '') |
| 21 |
{ |
| 22 |
$instance->add_control( |
| 23 |
'email_to' . $slug, |
| 24 |
[ |
| 25 |
'label' => esc_html__( 'To', 'uicore-elements' ), |
| 26 |
'type' => Controls_Manager::TEXT, |
| 27 |
'default' => get_option( 'admin_email' ), |
| 28 |
'ai' => [ |
| 29 |
'active' => false, |
| 30 |
], |
| 31 |
'placeholder' => get_option( 'admin_email' ), |
| 32 |
'label_block' => true, |
| 33 |
'title' => esc_html__( 'Separate emails with commas', 'uicore-elements' ), |
| 34 |
'render_type' => 'none', |
| 35 |
'dynamic' => [ |
| 36 |
'active' => true, |
| 37 |
], |
| 38 |
] |
| 39 |
); |
| 40 |
|
| 41 |
/* translators: %s: Site title. */ |
| 42 |
$default_message = sprintf( html_entity_decode( esc_html__( 'New message from "%s"', 'uicore-elements' ) ), get_option( 'blogname' ) ); |
| 43 |
|
| 44 |
$instance->add_control( |
| 45 |
'email_subject' . $slug, |
| 46 |
[ |
| 47 |
'label' => esc_html__( 'Subject', 'uicore-elements' ), |
| 48 |
'type' => Controls_Manager::TEXT, |
| 49 |
'default' => $default_message, |
| 50 |
'ai' => [ |
| 51 |
'active' => false, |
| 52 |
], |
| 53 |
'placeholder' => $default_message, |
| 54 |
'label_block' => true, |
| 55 |
'render_type' => 'none', |
| 56 |
'dynamic' => [ |
| 57 |
'active' => true, |
| 58 |
], |
| 59 |
] |
| 60 |
); |
| 61 |
|
| 62 |
$instance->add_control( |
| 63 |
'email_content' . $slug, |
| 64 |
[ |
| 65 |
'label' => esc_html__( 'Message', 'uicore-elements' ), |
| 66 |
'type' => Controls_Manager::TEXTAREA, |
| 67 |
'default' => '[all-fields]', |
| 68 |
'ai' => [ |
| 69 |
'active' => false, |
| 70 |
], |
| 71 |
'placeholder' => '[all-fields]', |
| 72 |
'description' => sprintf( |
| 73 |
/* translators: %s: The [all-fields] shortcode. */ |
| 74 |
esc_html__( 'By default, all form fields are sent via %s shortcode. To customize sent fields, copy the shortcode that appears inside each field and paste it above.', 'uicore-elements' ), |
| 75 |
'<code>[all-fields]</code>' |
| 76 |
), |
| 77 |
'render_type' => 'none', |
| 78 |
'dynamic' => [ |
| 79 |
'active' => true, |
| 80 |
], |
| 81 |
] |
| 82 |
); |
| 83 |
|
| 84 |
$site_domain = Helper::get_site_domain(); |
| 85 |
|
| 86 |
$instance->add_control( |
| 87 |
'email_from' . $slug, |
| 88 |
[ |
| 89 |
'label' => esc_html__( 'From Email', 'uicore-elements' ), |
| 90 |
'type' => Controls_Manager::TEXT, |
| 91 |
'default' => 'email@' . $site_domain, |
| 92 |
'ai' => [ |
| 93 |
'active' => false, |
| 94 |
], |
| 95 |
'render_type' => 'none', |
| 96 |
'dynamic' => [ |
| 97 |
'active' => true, |
| 98 |
], |
| 99 |
] |
| 100 |
); |
| 101 |
|
| 102 |
$instance->add_control( |
| 103 |
'email_from_name' . $slug, |
| 104 |
[ |
| 105 |
'label' => esc_html__( 'From Name', 'uicore-elements' ), |
| 106 |
'type' => Controls_Manager::TEXT, |
| 107 |
'default' => get_bloginfo( 'name' ), |
| 108 |
'ai' => [ |
| 109 |
'active' => false, |
| 110 |
], |
| 111 |
'render_type' => 'none', |
| 112 |
'dynamic' => [ |
| 113 |
'active' => true, |
| 114 |
], |
| 115 |
] |
| 116 |
); |
| 117 |
|
| 118 |
$instance->add_control( |
| 119 |
'email_reply_to' . $slug, |
| 120 |
[ |
| 121 |
'label' => esc_html__( 'Reply-To', 'uicore-elements' ), |
| 122 |
'type' => Controls_Manager::TEXT, |
| 123 |
'options' => [ |
| 124 |
'' => '', |
| 125 |
], |
| 126 |
'default' => 'noreply@' . Helper::get_site_domain(), |
| 127 |
'render_type' => 'none', |
| 128 |
] |
| 129 |
); |
| 130 |
|
| 131 |
$instance->add_control( |
| 132 |
'email_to_cc' . $slug, |
| 133 |
[ |
| 134 |
'label' => esc_html__( 'Cc', 'uicore-elements' ), |
| 135 |
'type' => Controls_Manager::TEXT, |
| 136 |
'default' => '', |
| 137 |
'ai' => [ |
| 138 |
'active' => false, |
| 139 |
], |
| 140 |
'title' => esc_html__( 'Separate emails with commas', 'uicore-elements' ), |
| 141 |
'render_type' => 'none', |
| 142 |
'dynamic' => [ |
| 143 |
'active' => true, |
| 144 |
], |
| 145 |
] |
| 146 |
); |
| 147 |
|
| 148 |
$instance->add_control( |
| 149 |
'email_to_bcc' . $slug, |
| 150 |
[ |
| 151 |
'label' => esc_html__( 'Bcc', 'uicore-elements' ), |
| 152 |
'type' => Controls_Manager::TEXT, |
| 153 |
'default' => '', |
| 154 |
'ai' => [ |
| 155 |
'active' => false, |
| 156 |
], |
| 157 |
'title' => esc_html__( 'Separate emails with commas', 'uicore-elements' ), |
| 158 |
'render_type' => 'none', |
| 159 |
'dynamic' => [ |
| 160 |
'active' => true, |
| 161 |
], |
| 162 |
] |
| 163 |
); |
| 164 |
|
| 165 |
$instance->add_control( |
| 166 |
'form_metadata' . $slug, |
| 167 |
[ |
| 168 |
'label' => esc_html__( 'Meta Data', 'uicore-elements' ), |
| 169 |
'type' => Controls_Manager::SELECT2, |
| 170 |
'multiple' => true, |
| 171 |
'label_block' => true, |
| 172 |
'separator' => 'before', |
| 173 |
'default' => [ |
| 174 |
'date', |
| 175 |
'time', |
| 176 |
'page_url', |
| 177 |
'user_agent', |
| 178 |
'remote_ip', |
| 179 |
], |
| 180 |
'options' => [ |
| 181 |
'date' => esc_html__( 'Date', 'uicore-elements' ), |
| 182 |
'time' => esc_html__( 'Time', 'uicore-elements' ), |
| 183 |
'page_url' => esc_html__( 'Page URL', 'uicore-elements' ), |
| 184 |
'user_agent' => esc_html__( 'User Agent', 'uicore-elements' ), |
| 185 |
'remote_ip' => esc_html__( 'Remote IP', 'uicore-elements' ), |
| 186 |
], |
| 187 |
'render_type' => 'none', |
| 188 |
] |
| 189 |
); |
| 190 |
|
| 191 |
$instance->add_control( |
| 192 |
'email_content_type' . $slug, |
| 193 |
[ |
| 194 |
'label' => esc_html__( 'Send As', 'uicore-elements' ), |
| 195 |
'type' => Controls_Manager::SELECT, |
| 196 |
'default' => 'html', |
| 197 |
'render_type' => 'none', |
| 198 |
'options' => [ |
| 199 |
'html' => esc_html__( 'HTML', 'uicore-elements' ), |
| 200 |
'plain' => esc_html__( 'Plain', 'uicore-elements' ), |
| 201 |
], |
| 202 |
] |
| 203 |
); |
| 204 |
} |
| 205 |
function TRAIT_register_submit_redirect_controls() |
| 206 |
{ |
| 207 |
$this->add_control( |
| 208 |
'redirect_to', |
| 209 |
[ |
| 210 |
'label' => esc_html__( 'Redirect To', 'uicore-elements' ), |
| 211 |
'type' => Controls_Manager::TEXT, |
| 212 |
'placeholder' => esc_html__( 'https://your-link.com', 'uicore-elements' ), |
| 213 |
'ai' => [ |
| 214 |
'active' => false, |
| 215 |
], |
| 216 |
'dynamic' => [ |
| 217 |
'active' => true, |
| 218 |
'categories' => [ |
| 219 |
'url', |
| 220 |
], |
| 221 |
], |
| 222 |
'label_block' => true, |
| 223 |
'render_type' => 'none', |
| 224 |
] |
| 225 |
); |
| 226 |
} |
| 227 |
/** |
| 228 |
* Register MailChimp controls for the submit action. |
| 229 |
* |
| 230 |
* @param $instance - The widget instance. Required if $has_repeaters is true. |
| 231 |
* @param bool $has_repeaters - Enable Field Mapping control if the widget has dynamic fields widh repeaters. |
| 232 |
* |
| 233 |
* @return void |
| 234 |
*/ |
| 235 |
function TRAIT_register_submit_mailchimp_controls($instance = null, bool $has_repeaters = false) |
| 236 |
{ |
| 237 |
|
| 238 |
if( !get_option('uicore_elements_mailchimp_secret_key') ) { |
| 239 |
$this->add_control( |
| 240 |
'mailchimp_warning', |
| 241 |
[ |
| 242 |
'type' => Controls_Manager::ALERT, |
| 243 |
'alert_type' => 'warning', |
| 244 |
'dismissible' => false, |
| 245 |
'heading' => esc_html__("You haven't set your Mailchimp API key yet.", 'uicore-elements'), |
| 246 |
'content' => Helper::get_admin_settings_url(esc_html__("Click here to configure your API keys.", 'uicore-elements' )), |
| 247 |
] |
| 248 |
); |
| 249 |
} |
| 250 |
|
| 251 |
$this->add_control( |
| 252 |
'mailchimp_audience_id', |
| 253 |
[ |
| 254 |
'label' => esc_html__( 'Audience ID', 'uicore-elements' ), |
| 255 |
'type' => Controls_Manager::TEXT, |
| 256 |
'description' => esc_html__( 'Enter the Audience ID to subscribe the user to.', 'uicore-elements' ), |
| 257 |
'ai' => [ |
| 258 |
'active' => false, |
| 259 |
], |
| 260 |
'dynamic' => [ |
| 261 |
'active' => true, |
| 262 |
], |
| 263 |
'label_block' => true, |
| 264 |
'render_type' => 'none', |
| 265 |
] |
| 266 |
); |
| 267 |
|
| 268 |
// If repeaters, than we need the field mapping controls |
| 269 |
if($has_repeaters) { |
| 270 |
$this->add_control( |
| 271 |
'mailchimp_map_description', |
| 272 |
[ |
| 273 |
'label' => esc_html__( 'Field Mapping', 'uicore-elements' ), |
| 274 |
'type' => Controls_Manager::RAW_HTML, |
| 275 |
'raw' => esc_html__( 'You need to set the "ID" of the field you want to map.', 'uicore-elements' ), |
| 276 |
'content_classes' => 'elementor-control-field-description', |
| 277 |
'separator' => 'before', |
| 278 |
] |
| 279 |
); |
| 280 |
$this->add_control( |
| 281 |
'mailchimp_email_id', |
| 282 |
[ |
| 283 |
'label' => esc_html__( 'Email*', 'uicore-elements' ), |
| 284 |
'type' => Controls_Manager::TEXT, |
| 285 |
'ai' => [ |
| 286 |
'active' => false, |
| 287 |
], |
| 288 |
'render_type' => 'none', |
| 289 |
] |
| 290 |
); |
| 291 |
$this->add_control( |
| 292 |
'mailchimp_birthday_id', |
| 293 |
[ |
| 294 |
'label' => esc_html__( 'Birthday', 'uicore-elements' ), |
| 295 |
'type' => Controls_Manager::TEXT, |
| 296 |
'description' => esc_html__( 'Expects the format MM/DD.', 'uicore-elements' ), |
| 297 |
'ai' => [ |
| 298 |
'active' => false, |
| 299 |
], |
| 300 |
'render_type' => 'none', |
| 301 |
] |
| 302 |
); |
| 303 |
$this->add_control( |
| 304 |
'mailchimp_fname_id', |
| 305 |
[ |
| 306 |
'label' => esc_html__( 'First Name', 'uicore-elements' ), |
| 307 |
'type' => Controls_Manager::TEXT, |
| 308 |
'ai' => [ |
| 309 |
'active' => false, |
| 310 |
], |
| 311 |
'render_type' => 'none', |
| 312 |
] |
| 313 |
); |
| 314 |
$this->add_control( |
| 315 |
'mailchimp_lname_id', |
| 316 |
[ |
| 317 |
'label' => esc_html__( 'Last Name', 'uicore-elements' ), |
| 318 |
'type' => Controls_Manager::TEXT, |
| 319 |
'ai' => [ |
| 320 |
'active' => false, |
| 321 |
], |
| 322 |
'render_type' => 'none', |
| 323 |
] |
| 324 |
); |
| 325 |
$this->add_control( |
| 326 |
'mailchimp_phone_id', |
| 327 |
[ |
| 328 |
'label' => esc_html__( 'Phone', 'uicore-elements' ), |
| 329 |
'type' => Controls_Manager::TEXT, |
| 330 |
'ai' => [ |
| 331 |
'active' => false, |
| 332 |
], |
| 333 |
'render_type' => 'none', |
| 334 |
] |
| 335 |
); |
| 336 |
|
| 337 |
} |
| 338 |
} |
| 339 |
|
| 340 |
// Settings and Content Controls |
| 341 |
function TRAIT_register_additional_controls($messages) |
| 342 |
{ |
| 343 |
$this->add_control( |
| 344 |
'form_id', |
| 345 |
[ |
| 346 |
'label' => esc_html__( 'Form ID', 'uicore-elements' ), |
| 347 |
'type' => Controls_Manager::TEXT, |
| 348 |
'ai' => [ |
| 349 |
'active' => false, |
| 350 |
], |
| 351 |
'placeholder' => 'new_form_id', |
| 352 |
'description' => esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page this form is displayed. This field allows `A-z 0-9` & underscore chars without spaces.', 'uicore-elements' ), |
| 353 |
'separator' => 'after', |
| 354 |
'dynamic' => [ |
| 355 |
'active' => true, |
| 356 |
], |
| 357 |
] |
| 358 |
); |
| 359 |
$this->add_control( |
| 360 |
'form_validation', |
| 361 |
[ |
| 362 |
'label' => esc_html__( 'Form Validation', 'uicore-elements' ), |
| 363 |
'type' => Controls_Manager::SELECT, |
| 364 |
'options' => [ |
| 365 |
'' => esc_html__( 'Browser Default', 'uicore-elements' ), |
| 366 |
'no' => esc_html__( 'No validation', 'uicore-elements' ), |
| 367 |
], |
| 368 |
'default' => '', |
| 369 |
] |
| 370 |
); |
| 371 |
$this->add_control( |
| 372 |
'custom_messages', |
| 373 |
[ |
| 374 |
'label' => esc_html__( 'Custom Messages', 'uicore-elements' ), |
| 375 |
'type' => Controls_Manager::SWITCHER, |
| 376 |
'default' => '', |
| 377 |
'separator' => 'before', |
| 378 |
'render_type' => 'none', |
| 379 |
] |
| 380 |
); |
| 381 |
$this->add_control( |
| 382 |
'success_message', |
| 383 |
[ |
| 384 |
'label' => esc_html__( 'Success Message', 'uicore-elements' ), |
| 385 |
'type' => Controls_Manager::TEXT, |
| 386 |
'default' => $messages['success'], |
| 387 |
'placeholder' => $messages['success'], |
| 388 |
'label_block' => true, |
| 389 |
'condition' => [ |
| 390 |
'custom_messages!' => '', |
| 391 |
], |
| 392 |
'render_type' => 'none', |
| 393 |
'dynamic' => [ |
| 394 |
'active' => true, |
| 395 |
], |
| 396 |
] |
| 397 |
); |
| 398 |
$this->add_control( |
| 399 |
'error_message', |
| 400 |
[ |
| 401 |
'label' => esc_html__( 'Form Error', 'uicore-elements' ), |
| 402 |
'type' => Controls_Manager::TEXT, |
| 403 |
'default' => $messages['error'], |
| 404 |
'placeholder' => $messages['error'], |
| 405 |
'label_block' => true, |
| 406 |
'condition' => [ |
| 407 |
'custom_messages!' => '', |
| 408 |
], |
| 409 |
'render_type' => 'none', |
| 410 |
'dynamic' => [ |
| 411 |
'active' => true, |
| 412 |
], |
| 413 |
] |
| 414 |
); |
| 415 |
$this->add_control( |
| 416 |
'mail_error_message', |
| 417 |
[ |
| 418 |
'label' => esc_html__( 'Email Sending Error', 'uicore-elements' ), |
| 419 |
'type' => Controls_Manager::TEXT, |
| 420 |
'default' => $messages['mail_error'], |
| 421 |
'placeholder' => $messages['mail_error'], |
| 422 |
'label_block' => true, |
| 423 |
'condition' => [ |
| 424 |
'custom_messages!' => '', |
| 425 |
], |
| 426 |
'render_type' => 'none', |
| 427 |
'dynamic' => [ |
| 428 |
'active' => true, |
| 429 |
], |
| 430 |
] |
| 431 |
); |
| 432 |
$this->add_control( |
| 433 |
'redirect_message', |
| 434 |
[ |
| 435 |
'label' => esc_html__( 'Sucessfull Redirect', 'uicore-elements' ), |
| 436 |
'type' => Controls_Manager::TEXT, |
| 437 |
'default' => $messages['redirect'], |
| 438 |
'placeholder' => $messages['redirect'], |
| 439 |
'label_block' => true, |
| 440 |
'conditions' => [ |
| 441 |
'terms' => [ |
| 442 |
[ |
| 443 |
'name' => 'custom_messages', |
| 444 |
'operator' => '!=', |
| 445 |
'value' => '', |
| 446 |
], |
| 447 |
[ |
| 448 |
'name' => 'submit_actions', |
| 449 |
'operator' => 'contains', |
| 450 |
'value' => 'redirect', |
| 451 |
] |
| 452 |
], |
| 453 |
], |
| 454 |
'render_type' => 'none', |
| 455 |
'dynamic' => [ |
| 456 |
'active' => true, |
| 457 |
], |
| 458 |
] |
| 459 |
); |
| 460 |
} |
| 461 |
function TRAIT_register_button_controls(string $submit_text = 'send') |
| 462 |
{ |
| 463 |
$this->add_responsive_control( |
| 464 |
'button_width', |
| 465 |
[ |
| 466 |
'label' => esc_html__( 'Column Width', 'uicore-elements' ), |
| 467 |
'type' => Controls_Manager::SELECT, |
| 468 |
'options' => $this->TRAIT_get_width_values(), |
| 469 |
'default' => '20', |
| 470 |
] |
| 471 |
); |
| 472 |
$this->add_responsive_control( |
| 473 |
'button_align', |
| 474 |
[ |
| 475 |
'label' => esc_html__( 'Alignment', 'uicore-elements' ), |
| 476 |
'type' => Controls_Manager::CHOOSE, |
| 477 |
'options' => [ |
| 478 |
'left' => [ |
| 479 |
'title' => esc_html__( 'Left', 'uicore-elements' ), |
| 480 |
'icon' => 'eicon-text-align-left', |
| 481 |
], |
| 482 |
'center' => [ |
| 483 |
'title' => esc_html__( 'Center', 'uicore-elements' ), |
| 484 |
'icon' => 'eicon-text-align-center', |
| 485 |
], |
| 486 |
'right' => [ |
| 487 |
'title' => esc_html__( 'Right', 'uicore-elements' ), |
| 488 |
'icon' => 'eicon-text-align-right', |
| 489 |
], |
| 490 |
'stretch' => [ |
| 491 |
'title' => esc_html__( 'Justified', 'uicore-elements' ), |
| 492 |
'icon' => 'eicon-text-align-justify', |
| 493 |
], |
| 494 |
], |
| 495 |
'default' => 'stretch', |
| 496 |
'prefix_class' => 'ui-e-submit-align-', |
| 497 |
] |
| 498 |
); |
| 499 |
$this->add_control( |
| 500 |
'button_text', |
| 501 |
[ |
| 502 |
'label' => esc_html__( 'Submit', 'uicore-elements' ), |
| 503 |
'type' => Controls_Manager::TEXT, |
| 504 |
/* translators: %s: Submit text */ |
| 505 |
'default' => esc_html( sprintf('%s', $submit_text), 'uicore-elements'), |
| 506 |
/* translators: %s: Submit text */ |
| 507 |
'placeholder' => esc_html( sprintf('%s', $submit_text), 'uicore-elements'), |
| 508 |
'dynamic' => [ |
| 509 |
'active' => true, |
| 510 |
], |
| 511 |
'ai' => [ |
| 512 |
'active' => false, |
| 513 |
], |
| 514 |
] |
| 515 |
); |
| 516 |
$this->add_control( |
| 517 |
'selected_button_icon', |
| 518 |
[ |
| 519 |
'label' => esc_html__( 'Icon', 'uicore-elements' ), |
| 520 |
'type' => Controls_Manager::ICONS, |
| 521 |
'skin' => 'inline', |
| 522 |
'label_block' => false, |
| 523 |
] |
| 524 |
); |
| 525 |
$this->add_control( |
| 526 |
'button_icon_align', |
| 527 |
[ |
| 528 |
'label' => esc_html__( 'Icon Position', 'uicore-elements' ), |
| 529 |
'type' => Controls_Manager::SELECT, |
| 530 |
'default' => 'left', |
| 531 |
'options' => [ |
| 532 |
'left' => esc_html__( 'Before', 'uicore-elements' ), |
| 533 |
'right' => esc_html__( 'After', 'uicore-elements' ), |
| 534 |
], |
| 535 |
'condition' => [ |
| 536 |
'selected_button_icon[value]!' => '', |
| 537 |
], |
| 538 |
] |
| 539 |
); |
| 540 |
$this->add_control( |
| 541 |
'button_icon_indent', |
| 542 |
[ |
| 543 |
'label' => esc_html__( 'Icon Spacing', 'uicore-elements' ), |
| 544 |
'type' => Controls_Manager::SLIDER, |
| 545 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 546 |
'range' => [ |
| 547 |
'px' => [ |
| 548 |
'max' => 100, |
| 549 |
], |
| 550 |
'em' => [ |
| 551 |
'max' => 10, |
| 552 |
], |
| 553 |
'rem' => [ |
| 554 |
'max' => 10, |
| 555 |
], |
| 556 |
], |
| 557 |
'condition' => [ |
| 558 |
'selected_button_icon[value]!' => '', |
| 559 |
], |
| 560 |
'selectors' => [ |
| 561 |
'{{WRAPPER}} .elementor-button .ui-e-align-right' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 562 |
'{{WRAPPER}} .elementor-button .ui-e-align-left' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 563 |
], |
| 564 |
] |
| 565 |
); |
| 566 |
$this->add_control( |
| 567 |
'button_css_id', |
| 568 |
[ |
| 569 |
'label' => esc_html__( 'Button ID', 'uicore-elements' ), |
| 570 |
'type' => Controls_Manager::TEXT, |
| 571 |
'default' => '', |
| 572 |
'ai' => [ |
| 573 |
'active' => false, |
| 574 |
], |
| 575 |
'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'uicore-elements' ), |
| 576 |
'description' => esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page this form is displayed. This field allows `A-z 0-9` & underscore chars without spaces.', 'uicore-elements' ), |
| 577 |
'separator' => 'before', |
| 578 |
'dynamic' => [ |
| 579 |
'active' => true, |
| 580 |
], |
| 581 |
] |
| 582 |
); |
| 583 |
} |
| 584 |
|
| 585 |
// Style Controls |
| 586 |
function TRAIT_register_form_style_controls($section = true) |
| 587 |
{ |
| 588 |
if($section){ |
| 589 |
$this->start_controls_section( |
| 590 |
'section_form_style', |
| 591 |
[ |
| 592 |
'label' => esc_html__( 'Form', 'uicore-elements' ), |
| 593 |
'tab' => Controls_Manager::TAB_STYLE, |
| 594 |
] |
| 595 |
); |
| 596 |
} |
| 597 |
$this->add_control( |
| 598 |
'column_gap', |
| 599 |
[ |
| 600 |
'label' => esc_html__( 'Columns Gap', 'uicore-elements' ), |
| 601 |
'type' => Controls_Manager::SLIDER, |
| 602 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 603 |
'default' => [ |
| 604 |
'size' => 10, |
| 605 |
], |
| 606 |
'range' => [ |
| 607 |
'px' => [ |
| 608 |
'max' => 60, |
| 609 |
], |
| 610 |
'em' => [ |
| 611 |
'max' => 6, |
| 612 |
], |
| 613 |
'rem' => [ |
| 614 |
'max' => 6, |
| 615 |
], |
| 616 |
], |
| 617 |
'selectors' => [ |
| 618 |
'{{WRAPPER}} .ui-e-field-group' => 'padding-right: calc( {{SIZE}}{{UNIT}}/2 ); padding-left: calc( {{SIZE}}{{UNIT}}/2 );', |
| 619 |
'{{WRAPPER}} .ui-e-fields-wrp' => 'margin-left: calc( -{{SIZE}}{{UNIT}}/2 ); margin-right: calc( -{{SIZE}}{{UNIT}}/2 );', |
| 620 |
], |
| 621 |
] |
| 622 |
); |
| 623 |
$this->add_control( |
| 624 |
'row_gap', |
| 625 |
[ |
| 626 |
'label' => esc_html__( 'Rows Gap', 'uicore-elements' ), |
| 627 |
'type' => Controls_Manager::SLIDER, |
| 628 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 629 |
'default' => [ |
| 630 |
'size' => 10, |
| 631 |
], |
| 632 |
'range' => [ |
| 633 |
'px' => [ |
| 634 |
'max' => 60, |
| 635 |
], |
| 636 |
'em' => [ |
| 637 |
'max' => 6, |
| 638 |
], |
| 639 |
'rem' => [ |
| 640 |
'max' => 6, |
| 641 |
], |
| 642 |
], |
| 643 |
'selectors' => [ |
| 644 |
'{{WRAPPER}} .ui-e-field-group' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 645 |
'{{WRAPPER}} .ui-e-fields-wrp' => 'margin-bottom: -{{SIZE}}{{UNIT}};', |
| 646 |
], |
| 647 |
] |
| 648 |
); |
| 649 |
$this->add_control( |
| 650 |
'heading_label', |
| 651 |
[ |
| 652 |
'label' => esc_html__( 'Label', 'uicore-elements' ), |
| 653 |
'type' => Controls_Manager::HEADING, |
| 654 |
'separator' => 'before', |
| 655 |
] |
| 656 |
); |
| 657 |
$this->add_control( |
| 658 |
'label_spacing', |
| 659 |
[ |
| 660 |
'label' => esc_html__( 'Spacing', 'uicore-elements' ), |
| 661 |
'type' => Controls_Manager::SLIDER, |
| 662 |
'size_units' => [ 'px', 'em', 'rem', 'custom' ], |
| 663 |
'default' => [ |
| 664 |
'size' => 0, |
| 665 |
], |
| 666 |
'range' => [ |
| 667 |
'px' => [ |
| 668 |
'max' => 60, |
| 669 |
], |
| 670 |
'em' => [ |
| 671 |
'max' => 6, |
| 672 |
], |
| 673 |
'rem' => [ |
| 674 |
'max' => 6, |
| 675 |
], |
| 676 |
], |
| 677 |
'selectors' => [ |
| 678 |
'body {{WRAPPER}} .ui-e-field-group > label' => 'padding-bottom: {{SIZE}}{{UNIT}};', |
| 679 |
], |
| 680 |
] |
| 681 |
); |
| 682 |
$this->add_control( |
| 683 |
'label_color', |
| 684 |
[ |
| 685 |
'label' => esc_html__( 'Text Color', 'uicore-elements' ), |
| 686 |
'type' => Controls_Manager::COLOR, |
| 687 |
'selectors' => [ |
| 688 |
'{{WRAPPER}} .ui-e-field-group > label, {{WRAPPER}} .ui-e-field-subgroup label' => 'color: {{VALUE}};', |
| 689 |
], |
| 690 |
'global' => [ |
| 691 |
'default' => Global_Colors::COLOR_TEXT, |
| 692 |
], |
| 693 |
] |
| 694 |
); |
| 695 |
$this->add_control( |
| 696 |
'mark_required_color', |
| 697 |
[ |
| 698 |
'label' => esc_html__( 'Mark Color', 'uicore-elements' ), |
| 699 |
'type' => Controls_Manager::COLOR, |
| 700 |
'default' => '', |
| 701 |
'selectors' => [ |
| 702 |
'{{WRAPPER}} .ui-e-required .ui-e-label:after' => 'color: {{COLOR}};', |
| 703 |
], |
| 704 |
'condition' => [ |
| 705 |
'mark_required' => 'yes', |
| 706 |
], |
| 707 |
] |
| 708 |
); |
| 709 |
$this->add_group_control( |
| 710 |
Group_Control_Typography::get_type(), |
| 711 |
[ |
| 712 |
'name' => 'label_typography', |
| 713 |
'selector' => '{{WRAPPER}} .ui-e-field-group > label', |
| 714 |
'global' => [ |
| 715 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 716 |
], |
| 717 |
] |
| 718 |
); |
| 719 |
if($section){ |
| 720 |
$this->end_controls_section(); |
| 721 |
} |
| 722 |
} |
| 723 |
function TRAIT_register_fields_style_controls($section = true) |
| 724 |
{ |
| 725 |
if($section){ |
| 726 |
$this->start_controls_section( |
| 727 |
'section_field_style', |
| 728 |
[ |
| 729 |
'label' => esc_html__( 'Fields', 'uicore-elements' ), |
| 730 |
'tab' => Controls_Manager::TAB_STYLE, |
| 731 |
] |
| 732 |
); |
| 733 |
} |
| 734 |
|
| 735 |
$this->start_controls_tabs( |
| 736 |
'field_style_tabs' |
| 737 |
); |
| 738 |
|
| 739 |
$this->start_controls_tab( |
| 740 |
'field_normal_tab', |
| 741 |
[ |
| 742 |
'label' => esc_html__( 'Normal', 'uicore-elements' ), |
| 743 |
] |
| 744 |
); |
| 745 |
|
| 746 |
$this->add_group_control( |
| 747 |
Group_Control_Typography::get_type(), |
| 748 |
[ |
| 749 |
'name' => 'field_typography', |
| 750 |
'selector' => '{{WRAPPER}} .ui-e-field-group .ui-e-field, {{WRAPPER}} .ui-e-field-subgroup label', |
| 751 |
'global' => [ |
| 752 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 753 |
], |
| 754 |
] |
| 755 |
); |
| 756 |
$this->add_control( |
| 757 |
'field_text_color', |
| 758 |
[ |
| 759 |
'label' => esc_html__( 'Text Color', 'uicore-elements' ), |
| 760 |
'type' => Controls_Manager::COLOR, |
| 761 |
'selectors' => [ |
| 762 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field' => 'color: {{VALUE}};', |
| 763 |
], |
| 764 |
'global' => [ |
| 765 |
'default' => Global_Colors::COLOR_TEXT, |
| 766 |
], |
| 767 |
] |
| 768 |
); |
| 769 |
$this->add_control( |
| 770 |
'field_placeholder_color', |
| 771 |
[ |
| 772 |
'label' => esc_html__( 'Placeholder Color', 'uicore-elements' ), |
| 773 |
'type' => Controls_Manager::COLOR, |
| 774 |
'selectors' => [ |
| 775 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field::placeholder' => 'color: {{VALUE}};', |
| 776 |
], |
| 777 |
'global' => [ |
| 778 |
'default' => Global_Colors::COLOR_TEXT, |
| 779 |
], |
| 780 |
] |
| 781 |
); |
| 782 |
$this->add_control( |
| 783 |
'field_background_color', |
| 784 |
[ |
| 785 |
'label' => esc_html__( 'Background Color', 'uicore-elements' ), |
| 786 |
'type' => Controls_Manager::COLOR, |
| 787 |
'default' => '#ffffff', |
| 788 |
'selectors' => [ |
| 789 |
'{{WRAPPER}} .ui-e-field-group:not(.ui-e-field-type-file) .ui-e-field:not(.ui-e-field-select)' => 'background-color: {{VALUE}};', |
| 790 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field-select select' => 'background-color: {{VALUE}};', |
| 791 |
], |
| 792 |
] |
| 793 |
); |
| 794 |
$this->add_group_control( |
| 795 |
Group_Control_Border::get_type(), |
| 796 |
[ |
| 797 |
'name' => 'field_border', |
| 798 |
'selector' => |
| 799 |
'{{WRAPPER}} .ui-e-field-group:not(.ui-e-field-type-file) .ui-e-field:not(.ui-e-field-select), |
| 800 |
{{WRAPPER}} .ui-e-field-group .ui-e-field-select select', |
| 801 |
] |
| 802 |
); |
| 803 |
|
| 804 |
$this->end_controls_tab(); |
| 805 |
|
| 806 |
$this->start_controls_tab( |
| 807 |
'field_hover_tab', |
| 808 |
[ |
| 809 |
'label' => esc_html__( 'Hover', 'uicore-elements' ), |
| 810 |
] |
| 811 |
); |
| 812 |
|
| 813 |
$this->add_control( |
| 814 |
'field_text_hover_color', |
| 815 |
[ |
| 816 |
'label' => esc_html__( 'Text Color', 'uicore-elements' ), |
| 817 |
'type' => Controls_Manager::COLOR, |
| 818 |
'selectors' => [ |
| 819 |
'{{WRAPPER}} .ui-e-field-group:hover .ui-e-field' => 'color: {{VALUE}};', |
| 820 |
], |
| 821 |
'global' => [ |
| 822 |
'default' => Global_Colors::COLOR_TEXT, |
| 823 |
], |
| 824 |
] |
| 825 |
); |
| 826 |
$this->add_control( |
| 827 |
'field_placeholder_hover_color', |
| 828 |
[ |
| 829 |
'label' => esc_html__( 'Placeholder Color', 'uicore-elements' ), |
| 830 |
'type' => Controls_Manager::COLOR, |
| 831 |
'selectors' => [ |
| 832 |
'{{WRAPPER}} .ui-e-field-group:hover .ui-e-field::placeholder' => 'color: {{VALUE}};', |
| 833 |
], |
| 834 |
'global' => [ |
| 835 |
'default' => Global_Colors::COLOR_TEXT, |
| 836 |
], |
| 837 |
] |
| 838 |
); |
| 839 |
$this->add_control( |
| 840 |
'field_background_hover_color', |
| 841 |
[ |
| 842 |
'label' => esc_html__( 'Background Color', 'uicore-elements' ), |
| 843 |
'type' => Controls_Manager::COLOR, |
| 844 |
'default' => '#ffffff', |
| 845 |
'selectors' => [ |
| 846 |
'{{WRAPPER}} .ui-e-field-group:hover:not(.ui-e-field-type-file) .ui-e-field:not(.ui-e-field-select)' => 'background-color: {{VALUE}};', |
| 847 |
'{{WRAPPER}} .ui-e-field-group:hover .ui-e-field-select select' => 'background-color: {{VALUE}};', |
| 848 |
], |
| 849 |
] |
| 850 |
); |
| 851 |
$this->add_group_control( |
| 852 |
Group_Control_Border::get_type(), |
| 853 |
[ |
| 854 |
'name' => 'field_hover_border', |
| 855 |
'selector' => |
| 856 |
'{{WRAPPER}} .ui-e-field-group:hover:not(.ui-e-field-type-file) .ui-e-field:not(.ui-e-field-select), |
| 857 |
{{WRAPPER}} .ui-e-field-group:hover .ui-e-field-select select', |
| 858 |
] |
| 859 |
); |
| 860 |
|
| 861 |
$this->end_controls_tab(); |
| 862 |
|
| 863 |
$this->start_controls_tab( |
| 864 |
'field_active_tab', |
| 865 |
[ |
| 866 |
'label' => esc_html__( 'Active', 'uicore-elements' ), |
| 867 |
] |
| 868 |
); |
| 869 |
|
| 870 |
$this->add_control( |
| 871 |
'field_text_active_color', |
| 872 |
[ |
| 873 |
'label' => esc_html__( 'Text Color', 'uicore-elements' ), |
| 874 |
'type' => Controls_Manager::COLOR, |
| 875 |
'selectors' => [ |
| 876 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field:focus' => 'color: {{VALUE}};', |
| 877 |
], |
| 878 |
'global' => [ |
| 879 |
'default' => Global_Colors::COLOR_TEXT, |
| 880 |
], |
| 881 |
] |
| 882 |
); |
| 883 |
$this->add_control( |
| 884 |
'field_background_active_color', |
| 885 |
[ |
| 886 |
'label' => esc_html__( 'Background Color', 'uicore-elements' ), |
| 887 |
'type' => Controls_Manager::COLOR, |
| 888 |
'default' => '#ffffff', |
| 889 |
'selectors' => [ |
| 890 |
'{{WRAPPER}} .ui-e-field-group:not(.ui-e-field-type-file) .ui-e-field:focus:not(.ui-e-field-select)' => 'background-color: {{VALUE}};', |
| 891 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field-select:focus select' => 'background-color: {{VALUE}};', |
| 892 |
], |
| 893 |
] |
| 894 |
); |
| 895 |
$this->add_group_control( |
| 896 |
Group_Control_Border::get_type(), |
| 897 |
[ |
| 898 |
'name' => 'field_active_border', |
| 899 |
'selector' => |
| 900 |
'{{WRAPPER}} .ui-e-field-group:not(.ui-e-field-type-file) .ui-e-field:focus:not(.ui-e-field-select), |
| 901 |
{{WRAPPER}} .ui-e-field-group .ui-e-field-select:focus select', |
| 902 |
] |
| 903 |
); |
| 904 |
|
| 905 |
$this->end_controls_tab(); |
| 906 |
|
| 907 |
$this->end_controls_tabs(); |
| 908 |
|
| 909 |
$this->add_control( |
| 910 |
'field_border_radius', |
| 911 |
[ |
| 912 |
'label' => esc_html__( 'Border Radius', 'uicore-elements' ), |
| 913 |
'type' => Controls_Manager::DIMENSIONS, |
| 914 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 915 |
'selectors' => [ |
| 916 |
'{{WRAPPER}} .ui-e-field-group:not(.ui-e-field-type-file) .ui-e-field:not(.ui-e-field-select)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 917 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field-select select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 918 |
], |
| 919 |
'separator' => 'before' |
| 920 |
] |
| 921 |
); |
| 922 |
$this->add_responsive_control( |
| 923 |
'field_padding', |
| 924 |
[ |
| 925 |
'label' => esc_html__( 'Padding', 'uicore-elements' ), |
| 926 |
'type' => Controls_Manager::DIMENSIONS, |
| 927 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 928 |
'selectors' => [ |
| 929 |
'{{WRAPPER}} .ui-e-field-group:not(.ui-e-field-type-file) .ui-e-field:not(.ui-e-field-select)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 930 |
'{{WRAPPER}} .ui-e-field-group .ui-e-field-select select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 931 |
], |
| 932 |
] |
| 933 |
); |
| 934 |
if($section){ |
| 935 |
$this->end_controls_section(); |
| 936 |
} |
| 937 |
} |
| 938 |
function TRAIT_register_button_style_controls($section = true) |
| 939 |
{ |
| 940 |
if($section){ |
| 941 |
$this->start_controls_section( |
| 942 |
'section_button_style', |
| 943 |
[ |
| 944 |
'label' => esc_html__( 'Button', 'uicore-elements' ), |
| 945 |
'tab' => Controls_Manager::TAB_STYLE, |
| 946 |
] |
| 947 |
); |
| 948 |
} |
| 949 |
|
| 950 |
$this->add_group_control( |
| 951 |
Group_Control_Typography::get_type(), |
| 952 |
[ |
| 953 |
'name' => 'button_typography', |
| 954 |
'global' => [ |
| 955 |
'default' => Global_Typography::TYPOGRAPHY_ACCENT, |
| 956 |
], |
| 957 |
'selector' => '{{WRAPPER}} .elementor-button', |
| 958 |
] |
| 959 |
); |
| 960 |
$this->add_group_control( |
| 961 |
Group_Control_Border::get_type(), [ |
| 962 |
'name' => 'button_border', |
| 963 |
'selector' => '{{WRAPPER}} .elementor-button', |
| 964 |
'exclude' => [ |
| 965 |
'color', |
| 966 |
], |
| 967 |
] |
| 968 |
); |
| 969 |
|
| 970 |
$this->start_controls_tabs( 'tabs_button_style' ); |
| 971 |
|
| 972 |
$this->start_controls_tab( |
| 973 |
'tab_button_normal', |
| 974 |
[ |
| 975 |
'label' => esc_html__( 'Normal', 'uicore-elements' ), |
| 976 |
] |
| 977 |
); |
| 978 |
|
| 979 |
$this->add_control( |
| 980 |
'button_background_color', |
| 981 |
[ |
| 982 |
'label' => esc_html__( 'Background Color', 'uicore-elements' ), |
| 983 |
'type' => Controls_Manager::COLOR, |
| 984 |
'global' => [ |
| 985 |
'default' => Global_Colors::COLOR_ACCENT, |
| 986 |
], |
| 987 |
'selectors' => [ |
| 988 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next' => 'background-color: {{VALUE}};', |
| 989 |
'{{WRAPPER}} .elementor-button[type="submit"]' => 'background-color: {{VALUE}};', |
| 990 |
], |
| 991 |
] |
| 992 |
); |
| 993 |
$this->add_control( |
| 994 |
'button_text_color', |
| 995 |
[ |
| 996 |
'label' => esc_html__( 'Text Color', 'uicore-elements' ), |
| 997 |
'type' => Controls_Manager::COLOR, |
| 998 |
'default' => '#ffffff', |
| 999 |
'selectors' => [ |
| 1000 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next' => 'color: {{VALUE}};', |
| 1001 |
'{{WRAPPER}} .elementor-button[type="submit"]' => 'color: {{VALUE}};', |
| 1002 |
'{{WRAPPER}} .elementor-button[type="submit"] svg *' => 'fill: {{VALUE}};', |
| 1003 |
], |
| 1004 |
] |
| 1005 |
); |
| 1006 |
$this->add_control( |
| 1007 |
'button_border_color', |
| 1008 |
[ |
| 1009 |
'label' => esc_html__( 'Border Color', 'uicore-elements' ), |
| 1010 |
'type' => Controls_Manager::COLOR, |
| 1011 |
'default' => '', |
| 1012 |
'selectors' => [ |
| 1013 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next' => 'border-color: {{VALUE}};', |
| 1014 |
'{{WRAPPER}} .elementor-button[type="submit"]' => 'border-color: {{VALUE}};', |
| 1015 |
], |
| 1016 |
'condition' => [ |
| 1017 |
'button_border_border!' => '', |
| 1018 |
], |
| 1019 |
] |
| 1020 |
); |
| 1021 |
|
| 1022 |
$this->end_controls_tab(); |
| 1023 |
|
| 1024 |
$this->start_controls_tab( |
| 1025 |
'tab_button_hover', |
| 1026 |
[ |
| 1027 |
'label' => esc_html__( 'Hover', 'uicore-elements' ), |
| 1028 |
] |
| 1029 |
); |
| 1030 |
|
| 1031 |
$this->add_control( |
| 1032 |
'button_background_hover_color', |
| 1033 |
[ |
| 1034 |
'label' => esc_html__( 'Background Color', 'uicore-elements' ), |
| 1035 |
'type' => Controls_Manager::COLOR, |
| 1036 |
'default' => '', |
| 1037 |
'selectors' => [ |
| 1038 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next:hover' => 'background-color: {{VALUE}};', |
| 1039 |
'{{WRAPPER}} .elementor-button[type="submit"]:hover' => 'background-color: {{VALUE}};', |
| 1040 |
], |
| 1041 |
] |
| 1042 |
); |
| 1043 |
$this->add_control( |
| 1044 |
'button_hover_color', |
| 1045 |
[ |
| 1046 |
'label' => esc_html__( 'Text Color', 'uicore-elements' ), |
| 1047 |
'type' => Controls_Manager::COLOR, |
| 1048 |
'default' => '#ffffff', |
| 1049 |
'selectors' => [ |
| 1050 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next:hover' => 'color: {{VALUE}};', |
| 1051 |
'{{WRAPPER}} .elementor-button[type="submit"]:hover' => 'color: {{VALUE}};', |
| 1052 |
'{{WRAPPER}} .elementor-button[type="submit"]:hover svg *' => 'fill: {{VALUE}};', |
| 1053 |
], |
| 1054 |
] |
| 1055 |
); |
| 1056 |
$this->add_control( |
| 1057 |
'button_hover_border_color', |
| 1058 |
[ |
| 1059 |
'label' => esc_html__( 'Border Color', 'uicore-elements' ), |
| 1060 |
'type' => Controls_Manager::COLOR, |
| 1061 |
'default' => '', |
| 1062 |
'selectors' => [ |
| 1063 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next:hover' => 'border-color: {{VALUE}};', |
| 1064 |
'{{WRAPPER}} .elementor-button[type="submit"]:hover' => 'border-color: {{VALUE}};', |
| 1065 |
], |
| 1066 |
'condition' => [ |
| 1067 |
'button_border_border!' => '', |
| 1068 |
], |
| 1069 |
] |
| 1070 |
); |
| 1071 |
$this->add_control( |
| 1072 |
'hover_transition_duration', |
| 1073 |
[ |
| 1074 |
'label' => esc_html__( 'Transition Duration', 'uicore-elements' ), |
| 1075 |
'type' => Controls_Manager::SLIDER, |
| 1076 |
'size_units' => [ 's', 'ms', 'custom' ], |
| 1077 |
'default' => [ |
| 1078 |
'unit' => 'ms', |
| 1079 |
], |
| 1080 |
'selectors' => [ |
| 1081 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-previous' => 'transition-duration: {{SIZE}}{{UNIT}};', |
| 1082 |
'{{WRAPPER}} .e-form__buttons__wrapper__button-next' => 'transition-duration: {{SIZE}}{{UNIT}};', |
| 1083 |
'{{WRAPPER}} .elementor-button[type="submit"] svg *' => 'transition-duration: {{SIZE}}{{UNIT}};', |
| 1084 |
'{{WRAPPER}} .elementor-button[type="submit"]' => 'transition-duration: {{SIZE}}{{UNIT}};', |
| 1085 |
], |
| 1086 |
] |
| 1087 |
); |
| 1088 |
$this->add_control( |
| 1089 |
'button_hover_animation', |
| 1090 |
[ |
| 1091 |
'label' => esc_html__( 'Animation', 'uicore-elements' ), |
| 1092 |
'type' => Controls_Manager::HOVER_ANIMATION, |
| 1093 |
] |
| 1094 |
); |
| 1095 |
|
| 1096 |
$this->end_controls_tab(); |
| 1097 |
|
| 1098 |
$this->end_controls_tabs(); |
| 1099 |
|
| 1100 |
$this->add_control( |
| 1101 |
'button_border_radius', |
| 1102 |
[ |
| 1103 |
'label' => esc_html__( 'Border Radius', 'uicore-elements' ), |
| 1104 |
'type' => Controls_Manager::DIMENSIONS, |
| 1105 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1106 |
'selectors' => [ |
| 1107 |
'{{WRAPPER}} .elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1108 |
], |
| 1109 |
'separator' => 'before', |
| 1110 |
] |
| 1111 |
); |
| 1112 |
|
| 1113 |
$this->add_control( |
| 1114 |
'button_text_padding', |
| 1115 |
[ |
| 1116 |
'label' => esc_html__( 'Text Padding', 'uicore-elements' ), |
| 1117 |
'type' => Controls_Manager::DIMENSIONS, |
| 1118 |
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 1119 |
'selectors' => [ |
| 1120 |
'{{WRAPPER}} .elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1121 |
], |
| 1122 |
] |
| 1123 |
); |
| 1124 |
|
| 1125 |
if($section){ |
| 1126 |
$this->end_controls_section(); |
| 1127 |
} |
| 1128 |
} |
| 1129 |
function TRAIT_register_messages_style_controls($section = true) |
| 1130 |
{ |
| 1131 |
if($section){ |
| 1132 |
$this->start_controls_section( |
| 1133 |
'section_messages_style', |
| 1134 |
[ |
| 1135 |
'label' => esc_html__( 'Messages', 'uicore-elements' ), |
| 1136 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1137 |
] |
| 1138 |
); |
| 1139 |
} |
| 1140 |
|
| 1141 |
$this->add_control( |
| 1142 |
'show_messages', |
| 1143 |
[ |
| 1144 |
'label' => esc_html__( 'Show/Hide messages', 'uicore-elements' ), |
| 1145 |
'type' => Controls_Manager::BUTTON, |
| 1146 |
'separator' => 'before', |
| 1147 |
'text' => esc_html__( 'Toggle', 'uicore-elements' ), |
| 1148 |
'event' => 'ui-e-form-show-messages', |
| 1149 |
] |
| 1150 |
); |
| 1151 |
$this->add_group_control( |
| 1152 |
Group_Control_Typography::get_type(), |
| 1153 |
[ |
| 1154 |
'name' => 'message_typography', |
| 1155 |
'global' => [ |
| 1156 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1157 |
], |
| 1158 |
'selector' => '{{WRAPPER}} .ui-e-message', |
| 1159 |
] |
| 1160 |
); |
| 1161 |
$this->add_control( |
| 1162 |
'success_message_color', |
| 1163 |
[ |
| 1164 |
'label' => esc_html__( 'Success Message Color', 'uicore-elements' ), |
| 1165 |
'type' => Controls_Manager::COLOR, |
| 1166 |
'default' => '#4CAF50', |
| 1167 |
'selectors' => [ |
| 1168 |
'{{WRAPPER}} .ui-e-message span.success' => 'color: {{COLOR}};', |
| 1169 |
], |
| 1170 |
] |
| 1171 |
); |
| 1172 |
$this->add_control( |
| 1173 |
'error_message_color', |
| 1174 |
[ |
| 1175 |
'label' => esc_html__( 'Error Message Color', 'uicore-elements' ), |
| 1176 |
'type' => Controls_Manager::COLOR, |
| 1177 |
'default' => '#F44336', |
| 1178 |
'selectors' => [ |
| 1179 |
'{{WRAPPER}} .ui-e-message span.error' => 'color: {{COLOR}};', |
| 1180 |
], |
| 1181 |
] |
| 1182 |
); |
| 1183 |
|
| 1184 |
if($section){ |
| 1185 |
$this->end_controls_section(); |
| 1186 |
} |
| 1187 |
} |
| 1188 |
function TRAIT_register_all_form_style_controls() |
| 1189 |
{ |
| 1190 |
$this->TRAIT_register_form_style_controls(); |
| 1191 |
$this->TRAIT_register_fields_style_controls(); |
| 1192 |
$this->TRAIT_register_button_style_controls(); |
| 1193 |
$this->TRAIT_register_messages_style_controls(); |
| 1194 |
} |
| 1195 |
|
| 1196 |
// Helper and Utility Functions |
| 1197 |
function TRAIT_get_width_values() |
| 1198 |
{ |
| 1199 |
return [ |
| 1200 |
'' => esc_html__( 'Default', 'uicore-elements' ), |
| 1201 |
'100' => '100%', |
| 1202 |
'80' => '80%', |
| 1203 |
'75' => '75%', |
| 1204 |
'70' => '70%', |
| 1205 |
'66' => '66%', |
| 1206 |
'60' => '60%', |
| 1207 |
'50' => '50%', |
| 1208 |
'40' => '40%', |
| 1209 |
'33' => '33%', |
| 1210 |
'30' => '30%', |
| 1211 |
'25' => '25%', |
| 1212 |
'20' => '20%', |
| 1213 |
]; |
| 1214 |
} |
| 1215 |
function TRAIT_recaptcha_key_js() |
| 1216 |
{ |
| 1217 |
?> |
| 1218 |
<script> |
| 1219 |
window.uicore_elements_recaptcha = '<?php echo esc_html(get_option('uicore_elements_recaptcha_site_key')); ?>'; |
| 1220 |
</script> |
| 1221 |
<?php |
| 1222 |
} |
| 1223 |
} |