form.php
2685 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Bricks\Widgets; |
| 5 | |
| 6 | use Jet_Form_Builder\Blocks; |
| 7 | use Jet_Form_Builder\Plugin; |
| 8 | use Jet_Form_Builder\Classes\Tools; |
| 9 | use Jet_Form_Builder\Classes\Arguments\Form_Arguments; |
| 10 | |
| 11 | // If this file is called directly, abort. |
| 12 | if ( ! defined( 'WPINC' ) ) { |
| 13 | die; |
| 14 | } |
| 15 | |
| 16 | class Form extends Base { |
| 17 | |
| 18 | /** |
| 19 | * Use predefined element category 'general' |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | public $category = 'jet-form-builder'; |
| 24 | /** |
| 25 | * Make sure to prefix your elements |
| 26 | * |
| 27 | * @var string |
| 28 | */ |
| 29 | public $name = 'jet-form-builder-form'; |
| 30 | /** |
| 31 | * Themify icon font class |
| 32 | * |
| 33 | * @var string |
| 34 | */ |
| 35 | public $icon = 'jet-form-builder-icon-forms'; |
| 36 | /** |
| 37 | * Default CSS selector |
| 38 | * |
| 39 | * @var string |
| 40 | */ |
| 41 | public $css_selector = ''; |
| 42 | /** |
| 43 | * Script(s) run when element is rendered on frontend or updated in builder |
| 44 | * |
| 45 | * @var array |
| 46 | */ |
| 47 | public $scripts = array(); |
| 48 | |
| 49 | // Return localised element label |
| 50 | public function get_label() { |
| 51 | return esc_html__( 'JetForm', 'jet-form-builder' ); |
| 52 | } |
| 53 | |
| 54 | // Set builder control groups |
| 55 | public function set_control_groups() { |
| 56 | $this->control_group_form_settings(); |
| 57 | $this->control_group_form_style(); |
| 58 | $this->control_group_label_style(); |
| 59 | $this->control_group_description_style(); |
| 60 | $this->control_group_input_style(); |
| 61 | $this->control_group_checkradio_style(); |
| 62 | $this->control_group_calc_fields_style(); |
| 63 | $this->control_group_range_fields_style(); |
| 64 | $this->control_group_heading_style(); |
| 65 | $this->control_group_repeater_style(); |
| 66 | $this->control_group_conditional_style(); |
| 67 | $this->control_group_submit_style(); |
| 68 | $this->control_group_form_break_style(); |
| 69 | $this->control_group_form_break_buttons_style(); |
| 70 | $this->control_group_form_break_message_style(); |
| 71 | $this->control_group_form_progress_wrap_style(); |
| 72 | $this->control_group_form_progress_pages_style(); |
| 73 | $this->control_group_message_style(); |
| 74 | } |
| 75 | |
| 76 | // Set builder controls |
| 77 | public function set_controls() { |
| 78 | $this->controls_form_settings(); |
| 79 | $this->controls_form_style(); |
| 80 | $this->controls_label_style(); |
| 81 | $this->controls_description_style(); |
| 82 | $this->controls_input_style(); |
| 83 | $this->controls_checkradio_style(); |
| 84 | $this->controls_calc_fields_style(); |
| 85 | $this->controls_range_fields_style(); |
| 86 | $this->controls_heading_style(); |
| 87 | $this->controls_repeater_style(); |
| 88 | $this->controls_conditional_style(); |
| 89 | $this->controls_submit_style(); |
| 90 | $this->controls_form_break_style(); |
| 91 | $this->controls_form_break_buttons_style(); |
| 92 | $this->controls_form_break_message_style(); |
| 93 | $this->controls_form_progress_wrap_style(); |
| 94 | $this->controls_form_progress_pages_style(); |
| 95 | $this->controls_message_style(); |
| 96 | } |
| 97 | |
| 98 | // Start form settings |
| 99 | public function control_group_form_settings() { |
| 100 | $this->register_jet_control_group( |
| 101 | 'form_settings', |
| 102 | array( |
| 103 | 'title' => esc_html__( 'Form settings', 'jet-form-builder' ), |
| 104 | 'tab' => 'content', |
| 105 | ) |
| 106 | ); |
| 107 | } |
| 108 | |
| 109 | public function controls_form_settings() { |
| 110 | $options = Form_Arguments::get_options( true ); |
| 111 | |
| 112 | $this->start_jet_control_group( 'form_settings' ); |
| 113 | |
| 114 | $this->register_jet_control( |
| 115 | 'form_id', |
| 116 | array( |
| 117 | 'tab' => 'content', |
| 118 | 'label' => esc_html__( 'Choose Form', 'jet-form-builder' ), |
| 119 | 'type' => 'select', |
| 120 | 'options' => Tools::get_forms_list_for_js( true ), |
| 121 | 'searchable' => true, |
| 122 | ) |
| 123 | ); |
| 124 | |
| 125 | $this->register_jet_control( |
| 126 | 'form_id_custom', |
| 127 | array( |
| 128 | 'tab' => 'content', |
| 129 | 'label' => esc_html__( 'Form ID', 'jet-form-builder' ), |
| 130 | 'type' => 'text', |
| 131 | 'default' => '', |
| 132 | 'hasDynamicData' => true, |
| 133 | 'required' => array( 'form_id', '=', 'manual_form_id' ), |
| 134 | ) |
| 135 | ); |
| 136 | |
| 137 | $this->register_jet_control( |
| 138 | 'fields_layout', |
| 139 | array( |
| 140 | 'tab' => 'content', |
| 141 | 'label' => esc_html__( 'Fields Layout', 'jet-form-builder' ), |
| 142 | 'type' => 'select', |
| 143 | 'options' => $options['fields_layout'], |
| 144 | ) |
| 145 | ); |
| 146 | |
| 147 | $this->register_jet_control( |
| 148 | 'required_mark', |
| 149 | array( |
| 150 | 'tab' => 'content', |
| 151 | 'label' => esc_html__( 'Required Mark', 'jet-form-builder' ), |
| 152 | 'type' => 'text', |
| 153 | 'default' => esc_html__( '*', 'jet-form-builder' ), |
| 154 | 'hasDynamicData' => false, |
| 155 | ) |
| 156 | ); |
| 157 | |
| 158 | $this->register_jet_control( |
| 159 | 'fields_label_tag', |
| 160 | array( |
| 161 | 'tab' => 'content', |
| 162 | 'label' => esc_html__( 'Fields label HTML tag', 'jet-form-builder' ), |
| 163 | 'type' => 'select', |
| 164 | 'options' => $options['fields_label_tag'], |
| 165 | ) |
| 166 | ); |
| 167 | |
| 168 | $this->register_jet_control( |
| 169 | 'submit_type', |
| 170 | array( |
| 171 | 'tab' => 'content', |
| 172 | 'label' => esc_html__( 'Submit Type', 'jet-form-builder' ), |
| 173 | 'type' => 'select', |
| 174 | 'options' => $options['submit_type'], |
| 175 | ) |
| 176 | ); |
| 177 | |
| 178 | $this->register_jet_control( |
| 179 | 'enable_progress', |
| 180 | array( |
| 181 | 'tab' => 'content', |
| 182 | 'label' => esc_html__( 'Enable form pages progress', 'jet-form-builder' ), |
| 183 | 'type' => 'checkbox', |
| 184 | 'default' => false, |
| 185 | ) |
| 186 | ); |
| 187 | |
| 188 | $this->register_jet_control( |
| 189 | 'clear', |
| 190 | array( |
| 191 | 'tab' => 'content', |
| 192 | 'label' => esc_html__( 'Clear data on success submit', 'jet-form-builder' ), |
| 193 | 'type' => 'checkbox', |
| 194 | 'default' => false, |
| 195 | ) |
| 196 | ); |
| 197 | |
| 198 | $this->end_jet_control_group(); |
| 199 | } |
| 200 | // End form settings |
| 201 | |
| 202 | // Start form style |
| 203 | public function control_group_form_style() { |
| 204 | $this->register_jet_control_group( |
| 205 | 'form_style', |
| 206 | array( |
| 207 | 'title' => esc_html__( 'Form Row', 'jet-form-builder' ), |
| 208 | 'tab' => 'style', |
| 209 | ) |
| 210 | ); |
| 211 | } |
| 212 | |
| 213 | public function controls_form_style() { |
| 214 | $this->start_jet_control_group( 'form_style' ); |
| 215 | |
| 216 | $this->register_jet_control( |
| 217 | 'form_row_gap_before', |
| 218 | array( |
| 219 | 'tab' => 'style', |
| 220 | 'label' => esc_html__( 'Gap Before', 'jet-form-builder' ), |
| 221 | 'type' => 'number', |
| 222 | 'units' => true, |
| 223 | 'min' => 1, |
| 224 | 'max' => 100, |
| 225 | 'css' => array( array( 'property' => '--jfb-row-mt' ) ), |
| 226 | ) |
| 227 | ); |
| 228 | |
| 229 | $this->register_jet_control( |
| 230 | 'form_row_gap_after', |
| 231 | array( |
| 232 | 'tab' => 'style', |
| 233 | 'label' => esc_html__( 'Gap After', 'jet-form-builder' ), |
| 234 | 'type' => 'number', |
| 235 | 'units' => true, |
| 236 | 'min' => 1, |
| 237 | 'max' => 100, |
| 238 | 'css' => array( array( 'property' => '--jfb-row-mb' ) ), |
| 239 | ) |
| 240 | ); |
| 241 | |
| 242 | $this->end_jet_control_group(); |
| 243 | } |
| 244 | // End form style |
| 245 | |
| 246 | // Start label style |
| 247 | public function control_group_label_style() { |
| 248 | $this->register_jet_control_group( |
| 249 | 'section_label_style', |
| 250 | array( |
| 251 | 'title' => esc_html__( 'Label', 'jet-form-builder' ), |
| 252 | 'tab' => 'style', |
| 253 | ) |
| 254 | ); |
| 255 | } |
| 256 | |
| 257 | public function controls_label_style() { |
| 258 | $this->start_jet_control_group( 'section_label_style' ); |
| 259 | |
| 260 | $css_selectors = array( |
| 261 | 'label' => $this->css_selector( '__label' ), |
| 262 | 'label-text' => $this->css_selector( '__label' ) . ' ' . $this->css_selector( '__label-text' ), |
| 263 | ); |
| 264 | |
| 265 | $this->register_jet_control( |
| 266 | 'label_typography', |
| 267 | array( |
| 268 | 'tab' => 'style', |
| 269 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 270 | 'type' => 'typography', |
| 271 | 'css' => array( |
| 272 | array( |
| 273 | 'property' => 'typography', |
| 274 | 'selector' => $css_selectors['label-text'], |
| 275 | ), |
| 276 | ), |
| 277 | ) |
| 278 | ); |
| 279 | |
| 280 | $this->register_jet_control( |
| 281 | 'label_bg_color', |
| 282 | array( |
| 283 | 'tab' => 'style', |
| 284 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 285 | 'type' => 'color', |
| 286 | 'css' => array( array( 'property' => '--jfb-label-bgc' ) ), |
| 287 | ) |
| 288 | ); |
| 289 | |
| 290 | $this->register_jet_control( |
| 291 | 'label_margin', |
| 292 | array( |
| 293 | 'tab' => 'style', |
| 294 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 295 | 'type' => 'dimensions', |
| 296 | 'css' => array( |
| 297 | array( |
| 298 | 'property' => 'margin', |
| 299 | 'selector' => $css_selectors['label'], |
| 300 | ), |
| 301 | ), |
| 302 | ) |
| 303 | ); |
| 304 | |
| 305 | $this->register_jet_control( |
| 306 | 'label_padding', |
| 307 | array( |
| 308 | 'tab' => 'style', |
| 309 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 310 | 'type' => 'dimensions', |
| 311 | 'css' => array( |
| 312 | array( |
| 313 | 'property' => 'padding', |
| 314 | 'selector' => $css_selectors['label'], |
| 315 | ), |
| 316 | ), |
| 317 | ) |
| 318 | ); |
| 319 | |
| 320 | $this->register_jet_control( |
| 321 | 'label_border', |
| 322 | array( |
| 323 | 'tab' => 'style', |
| 324 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 325 | 'type' => 'border', |
| 326 | 'css' => array( |
| 327 | array( |
| 328 | 'property' => 'border', |
| 329 | 'selector' => $css_selectors['label'], |
| 330 | ), |
| 331 | ), |
| 332 | ) |
| 333 | ); |
| 334 | |
| 335 | $this->register_jet_control( |
| 336 | 'form_required_mark', |
| 337 | array( |
| 338 | 'tab' => 'style', |
| 339 | 'type' => 'separator', |
| 340 | 'label' => esc_html__( 'Required Mark', 'jet-form-builder' ), |
| 341 | ) |
| 342 | ); |
| 343 | |
| 344 | $this->register_jet_control( |
| 345 | 'form_required_typography', |
| 346 | array( |
| 347 | 'tab' => 'style', |
| 348 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 349 | 'type' => 'typography', |
| 350 | 'css' => array( |
| 351 | array( |
| 352 | 'property' => 'typography', |
| 353 | 'selector' => $this->css_selector( '__required' ), |
| 354 | ), |
| 355 | ), |
| 356 | ) |
| 357 | ); |
| 358 | |
| 359 | $this->end_jet_control_group(); |
| 360 | } |
| 361 | // End label style |
| 362 | |
| 363 | // Start description style |
| 364 | public function control_group_description_style() { |
| 365 | $this->register_jet_control_group( |
| 366 | 'section_description_style', |
| 367 | array( |
| 368 | 'title' => esc_html__( 'Description', 'jet-form-builder' ), |
| 369 | 'tab' => 'style', |
| 370 | ) |
| 371 | ); |
| 372 | } |
| 373 | |
| 374 | public function controls_description_style() { |
| 375 | $this->start_jet_control_group( 'section_description_style' ); |
| 376 | |
| 377 | $css_selector = $this->css_selector( '__desc' ); |
| 378 | |
| 379 | $this->register_jet_control( |
| 380 | 'description_typography', |
| 381 | array( |
| 382 | 'tab' => 'style', |
| 383 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 384 | 'type' => 'typography', |
| 385 | 'css' => array( |
| 386 | array( |
| 387 | 'property' => 'typography', |
| 388 | 'selector' => $css_selector, |
| 389 | ), |
| 390 | ), |
| 391 | ) |
| 392 | ); |
| 393 | |
| 394 | $this->register_jet_control( |
| 395 | 'description_bg_color', |
| 396 | array( |
| 397 | 'tab' => 'style', |
| 398 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 399 | 'type' => 'color', |
| 400 | 'css' => array( array( 'property' => '--jfb-desc-bgc' ) ), |
| 401 | ) |
| 402 | ); |
| 403 | |
| 404 | $this->register_jet_control( |
| 405 | 'description_margin', |
| 406 | array( |
| 407 | 'tab' => 'style', |
| 408 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 409 | 'type' => 'dimensions', |
| 410 | 'css' => array( |
| 411 | array( |
| 412 | 'property' => 'margin', |
| 413 | 'selector' => $css_selector, |
| 414 | ), |
| 415 | ), |
| 416 | ) |
| 417 | ); |
| 418 | |
| 419 | $this->register_jet_control( |
| 420 | 'description_padding', |
| 421 | array( |
| 422 | 'tab' => 'style', |
| 423 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 424 | 'type' => 'dimensions', |
| 425 | 'css' => array( |
| 426 | array( |
| 427 | 'property' => 'padding', |
| 428 | 'selector' => $css_selector, |
| 429 | ), |
| 430 | ), |
| 431 | ) |
| 432 | ); |
| 433 | |
| 434 | $this->register_jet_control( |
| 435 | 'description_border', |
| 436 | array( |
| 437 | 'tab' => 'style', |
| 438 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 439 | 'type' => 'border', |
| 440 | 'css' => array( |
| 441 | array( |
| 442 | 'property' => 'border', |
| 443 | 'selector' => $css_selector, |
| 444 | ), |
| 445 | ), |
| 446 | ) |
| 447 | ); |
| 448 | |
| 449 | $this->end_jet_control_group(); |
| 450 | } |
| 451 | // End description style |
| 452 | |
| 453 | // Start input style |
| 454 | public function control_group_input_style() { |
| 455 | $this->register_jet_control_group( |
| 456 | 'section_input_style', |
| 457 | array( |
| 458 | 'title' => esc_html__( 'Input fields', 'jet-form-builder' ), |
| 459 | 'tab' => 'style', |
| 460 | ) |
| 461 | ); |
| 462 | } |
| 463 | |
| 464 | public function controls_input_style() { |
| 465 | $repeater_class = $this->css_selector( '-repeater' ); |
| 466 | $css_selector = $this->css_selector( "__field:not(.checkradio-field):not(.range-field):not($repeater_class):not(.wysiwyg-field)" ); |
| 467 | |
| 468 | $this->start_jet_control_group( 'section_input_style' ); |
| 469 | |
| 470 | $this->register_jet_control( |
| 471 | 'input_typography', |
| 472 | array( |
| 473 | 'tab' => 'style', |
| 474 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 475 | 'type' => 'typography', |
| 476 | 'css' => array( |
| 477 | array( |
| 478 | 'property' => 'typography', |
| 479 | 'selector' => $css_selector, |
| 480 | ), |
| 481 | ), |
| 482 | ) |
| 483 | ); |
| 484 | |
| 485 | $this->register_jet_control( |
| 486 | 'input_placeholder_color', |
| 487 | array( |
| 488 | 'tab' => 'style', |
| 489 | 'label' => esc_html__( 'Placeholder color', 'jet-form-builder' ), |
| 490 | 'type' => 'color', |
| 491 | 'css' => array( array( 'property' => '--jfb-input-phc' ) ), |
| 492 | ) |
| 493 | ); |
| 494 | |
| 495 | $this->register_jet_control( |
| 496 | 'input_bg_color', |
| 497 | array( |
| 498 | 'tab' => 'style', |
| 499 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 500 | 'type' => 'color', |
| 501 | 'css' => array( |
| 502 | array( |
| 503 | 'property' => 'background-color', |
| 504 | 'selector' => $css_selector, |
| 505 | ), |
| 506 | ), |
| 507 | ) |
| 508 | ); |
| 509 | |
| 510 | $this->register_jet_control( |
| 511 | 'input_margin', |
| 512 | array( |
| 513 | 'tab' => 'style', |
| 514 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 515 | 'type' => 'dimensions', |
| 516 | 'css' => array( |
| 517 | array( |
| 518 | 'property' => 'margin', |
| 519 | 'selector' => $css_selector, |
| 520 | ), |
| 521 | ), |
| 522 | ) |
| 523 | ); |
| 524 | |
| 525 | $this->register_jet_control( |
| 526 | 'input_padding', |
| 527 | array( |
| 528 | 'tab' => 'style', |
| 529 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 530 | 'type' => 'dimensions', |
| 531 | 'css' => array( |
| 532 | array( |
| 533 | 'property' => 'padding', |
| 534 | 'selector' => $css_selector, |
| 535 | ), |
| 536 | ), |
| 537 | ) |
| 538 | ); |
| 539 | |
| 540 | $this->register_jet_control( |
| 541 | 'input_border', |
| 542 | array( |
| 543 | 'tab' => 'style', |
| 544 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 545 | 'type' => 'border', |
| 546 | 'css' => array( |
| 547 | array( |
| 548 | 'property' => 'border', |
| 549 | 'selector' => $css_selector, |
| 550 | ), |
| 551 | ), |
| 552 | ) |
| 553 | ); |
| 554 | |
| 555 | $this->register_jet_control( |
| 556 | 'input_box_shadow', |
| 557 | array( |
| 558 | 'tab' => 'style', |
| 559 | 'label' => esc_html__( 'Box shadow', 'jet-form-builder' ), |
| 560 | 'type' => 'box-shadow', |
| 561 | 'css' => array( |
| 562 | array( |
| 563 | 'property' => 'box-shadow', |
| 564 | 'selector' => $css_selector, |
| 565 | ), |
| 566 | ), |
| 567 | ) |
| 568 | ); |
| 569 | |
| 570 | $this->register_jet_control( |
| 571 | 'input_width', |
| 572 | array( |
| 573 | 'tab' => 'style', |
| 574 | 'label' => esc_html__( 'Fields width', 'jet-form-builder' ), |
| 575 | 'type' => 'number', |
| 576 | 'units' => true, |
| 577 | 'min' => 50, |
| 578 | 'max' => 1000, |
| 579 | 'css' => array( array( 'property' => '--jfb-input-w' ) ), |
| 580 | ) |
| 581 | ); |
| 582 | |
| 583 | $this->register_jet_control( |
| 584 | 'input_textarea_height', |
| 585 | array( |
| 586 | 'tab' => 'style', |
| 587 | 'label' => esc_html__( 'Textarea height', 'jet-form-builder' ), |
| 588 | 'type' => 'number', |
| 589 | 'units' => true, |
| 590 | 'min' => 10, |
| 591 | 'max' => 500, |
| 592 | 'css' => array( array( 'property' => '--jfb-input-h' ) ), |
| 593 | ) |
| 594 | ); |
| 595 | |
| 596 | $this->register_jet_control( |
| 597 | 'input_color_scheme', |
| 598 | array( |
| 599 | 'tab' => 'style', |
| 600 | 'label' => esc_html__( 'Color scheme', 'jet-form-builder' ), |
| 601 | 'type' => 'select', |
| 602 | 'options' => array( |
| 603 | 'normal' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 604 | 'light' => esc_html__( 'Light', 'jet-form-builder' ), |
| 605 | 'dark' => esc_html__( 'Dark', 'jet-form-builder' ), |
| 606 | ), |
| 607 | 'default' => 'normal', |
| 608 | 'description' => esc_html__( 'Affects default browser UI elements like date and time icons, UI etc.', 'jet-form-builder' ), |
| 609 | 'css' => array( array( 'property' => '--jfb-input-color-scheme' ) ), |
| 610 | ) |
| 611 | ); |
| 612 | |
| 613 | $this->end_jet_control_group(); |
| 614 | } |
| 615 | // End input style |
| 616 | |
| 617 | // Start checkbox & radio fields style |
| 618 | public function control_group_checkradio_style() { |
| 619 | $this->register_jet_control_group( |
| 620 | 'section_checkradio_style', |
| 621 | array( |
| 622 | 'title' => esc_html__( 'Checkbox & Radio fields', 'jet-form-builder' ), |
| 623 | 'tab' => 'style', |
| 624 | ) |
| 625 | ); |
| 626 | } |
| 627 | |
| 628 | public function controls_checkradio_style() { |
| 629 | $this->start_jet_control_group( 'section_checkradio_style' ); |
| 630 | |
| 631 | $this->register_jet_control( |
| 632 | 'checkradio_fields_layout', |
| 633 | array( |
| 634 | 'tab' => 'style', |
| 635 | 'label' => esc_html__( 'Layout', 'jet-form-builder' ), |
| 636 | 'type' => 'select', |
| 637 | 'options' => array( |
| 638 | 'row' => esc_html__( 'Horizontal', 'jet-form-builder' ), |
| 639 | 'columns' => esc_html__( 'Vertical', 'jet-form-builder' ), |
| 640 | ), |
| 641 | 'default' => 'column', |
| 642 | 'css' => array( |
| 643 | array( |
| 644 | 'property' => 'flex-direction', |
| 645 | 'selector' => $this->css_selector( '__fields-group' ), |
| 646 | ), |
| 647 | ), |
| 648 | ) |
| 649 | ); |
| 650 | |
| 651 | $this->register_jet_control( |
| 652 | 'checkradio_fields_gaps', |
| 653 | array( |
| 654 | 'tab' => 'style', |
| 655 | 'label' => esc_html__( 'Gaps', 'jet-form-builder' ), |
| 656 | 'type' => 'dimensions', |
| 657 | 'directions' => array( |
| 658 | 'row' => esc_html__( 'Row', 'jet-form-builder' ), |
| 659 | 'column' => esc_html__( 'Column', 'jet-form-builder' ), |
| 660 | ), |
| 661 | 'css' => array( |
| 662 | array( |
| 663 | 'property' => '{key}-gap', |
| 664 | 'selector' => $this->css_selector( '__fields-group' ), |
| 665 | ), |
| 666 | ), |
| 667 | ) |
| 668 | ); |
| 669 | |
| 670 | $this->register_jet_control( |
| 671 | 'checkradio_fields_gap', |
| 672 | array( |
| 673 | 'tab' => 'style', |
| 674 | 'label' => esc_html__( 'Gap between control and label', 'jet-form-builder' ), |
| 675 | 'type' => 'number', |
| 676 | 'units' => true, |
| 677 | 'min' => 0, |
| 678 | 'max' => 50, |
| 679 | 'css' => array( |
| 680 | array( |
| 681 | 'property' => 'gap', |
| 682 | 'selector' => $this->css_selector( '__field-wrap.checkradio-wrap span' ), |
| 683 | ), |
| 684 | ), |
| 685 | ) |
| 686 | ); |
| 687 | |
| 688 | $this->register_jet_control( |
| 689 | 'checkradio_fields_control_size', |
| 690 | array( |
| 691 | 'tab' => 'style', |
| 692 | 'label' => esc_html__( 'Control size', 'jet-form-builder' ), |
| 693 | 'type' => 'number', |
| 694 | 'units' => true, |
| 695 | 'min' => 0, |
| 696 | 'max' => 50, |
| 697 | 'css' => array( array( 'property' => '--jfb-checkradio-fz' ) ), |
| 698 | ) |
| 699 | ); |
| 700 | |
| 701 | $this->register_jet_control( |
| 702 | 'checkradio_fields_typography', |
| 703 | array( |
| 704 | 'tab' => 'style', |
| 705 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 706 | 'type' => 'typography', |
| 707 | 'css' => array( |
| 708 | array( |
| 709 | 'property' => 'typography', |
| 710 | 'selector' => $this->css_selector( '__field-label' ), |
| 711 | ), |
| 712 | ), |
| 713 | ) |
| 714 | ); |
| 715 | |
| 716 | $this->register_jet_control( |
| 717 | 'checkradio_fields_box_heading', |
| 718 | array( |
| 719 | 'tab' => 'style', |
| 720 | 'type' => 'separator', |
| 721 | 'label' => esc_html__( 'Box', 'jet-form-builder' ), |
| 722 | ) |
| 723 | ); |
| 724 | |
| 725 | $this->register_jet_control( |
| 726 | 'checkradio_fields_box_border', |
| 727 | array( |
| 728 | 'tab' => 'style', |
| 729 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 730 | 'type' => 'border', |
| 731 | 'css' => array( |
| 732 | array( |
| 733 | 'property' => 'border', |
| 734 | 'selector' => $this->css_selector( '__field-label > span::before' ), |
| 735 | ), |
| 736 | ), |
| 737 | ) |
| 738 | ); |
| 739 | |
| 740 | $this->register_jet_control( |
| 741 | 'checkradio_fields_box_bg_color', |
| 742 | array( |
| 743 | 'tab' => 'style', |
| 744 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 745 | 'type' => 'color', |
| 746 | 'css' => array( array( 'property' => '--jfb-checkradio-input-bgc' ) ), |
| 747 | ) |
| 748 | ); |
| 749 | |
| 750 | $this->register_jet_control( |
| 751 | 'checkradio_fields_box_checked_heading', |
| 752 | array( |
| 753 | 'tab' => 'style', |
| 754 | 'type' => 'separator', |
| 755 | 'label' => esc_html__( 'Checked state', 'jet-form-builder' ), |
| 756 | ) |
| 757 | ); |
| 758 | |
| 759 | $this->register_jet_control( |
| 760 | 'checkradio_fields_box_checked_bg', |
| 761 | array( |
| 762 | 'tab' => 'style', |
| 763 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 764 | 'type' => 'color', |
| 765 | 'css' => array( array( 'property' => '--jfb-checkradio-input-checked-bgc' ) ), |
| 766 | ) |
| 767 | ); |
| 768 | |
| 769 | $this->register_jet_control( |
| 770 | 'checkradio_fields_box_checked_border_color', |
| 771 | array( |
| 772 | 'tab' => 'style', |
| 773 | 'label' => esc_html__( 'Border color', 'jet-form-builder' ), |
| 774 | 'type' => 'color', |
| 775 | 'css' => array( |
| 776 | array( |
| 777 | 'property' => 'border-color', |
| 778 | 'selector' => $this->css_selector( '__field-label :checked + span::before' ), |
| 779 | ), |
| 780 | ), |
| 781 | ) |
| 782 | ); |
| 783 | |
| 784 | $this->end_jet_control_group(); |
| 785 | } |
| 786 | // End checkbox & radio fields style |
| 787 | |
| 788 | // Start calculated fields |
| 789 | public function control_group_calc_fields_style() { |
| 790 | $this->register_jet_control_group( |
| 791 | 'section_calc_fields_style', |
| 792 | array( |
| 793 | 'title' => esc_html__( 'Calculated fields', 'jet-form-builder' ), |
| 794 | 'tab' => 'style', |
| 795 | ) |
| 796 | ); |
| 797 | } |
| 798 | |
| 799 | public function controls_calc_fields_style() { |
| 800 | $this->start_jet_control_group( 'section_calc_fields_style' ); |
| 801 | |
| 802 | $this->register_jet_control( |
| 803 | 'calc_fields_align_main_axis', |
| 804 | array( |
| 805 | 'tab' => 'style', |
| 806 | 'label' => esc_html__( 'Align main axis', 'jet-form-builder' ), |
| 807 | 'type' => 'justify-content', |
| 808 | 'css' => array( array( 'property' => '--jfb-calc-justify-content' ) ), |
| 809 | ) |
| 810 | ); |
| 811 | |
| 812 | $this->register_jet_control( |
| 813 | 'calc_fields_gap', |
| 814 | array( |
| 815 | 'tab' => 'style', |
| 816 | 'label' => esc_html__( 'Gap', 'jet-form-builder' ), |
| 817 | 'type' => 'number', |
| 818 | 'units' => true, |
| 819 | 'min' => 0, |
| 820 | 'max' => 40, |
| 821 | 'css' => array( array( 'property' => '--jfb-calc-gap' ) ), |
| 822 | ) |
| 823 | ); |
| 824 | |
| 825 | $css_selector = $this->css_selector( '__calculated-field' ); |
| 826 | |
| 827 | $this->register_jet_control( |
| 828 | 'calc_fields_typography', |
| 829 | array( |
| 830 | 'tab' => 'style', |
| 831 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 832 | 'type' => 'typography', |
| 833 | 'css' => array( |
| 834 | array( |
| 835 | 'property' => 'typography', |
| 836 | 'selector' => $css_selector, |
| 837 | ), |
| 838 | ), |
| 839 | ) |
| 840 | ); |
| 841 | |
| 842 | $this->register_jet_control( |
| 843 | 'calc_fields_prefix_size', |
| 844 | array( |
| 845 | 'tab' => 'style', |
| 846 | 'label' => esc_html__( 'Prefix size', 'jet-form-builder' ), |
| 847 | 'type' => 'number', |
| 848 | 'units' => true, |
| 849 | 'min' => 10, |
| 850 | 'max' => 50, |
| 851 | 'css' => array( array( 'property' => '--jfb-calc-prefix-fz' ) ), |
| 852 | ) |
| 853 | ); |
| 854 | |
| 855 | $this->register_jet_control( |
| 856 | 'calc_fields_prefix_color', |
| 857 | array( |
| 858 | 'tab' => 'style', |
| 859 | 'label' => esc_html__( 'Prefix color', 'jet-form-builder' ), |
| 860 | 'type' => 'color', |
| 861 | 'css' => array( array( 'property' => '--jfb-calc-prefix-color' ) ), |
| 862 | ) |
| 863 | ); |
| 864 | |
| 865 | $this->register_jet_control( |
| 866 | 'calc_fields_suffix_size', |
| 867 | array( |
| 868 | 'tab' => 'style', |
| 869 | 'label' => esc_html__( 'Suffix size', 'jet-form-builder' ), |
| 870 | 'type' => 'number', |
| 871 | 'units' => true, |
| 872 | 'min' => 10, |
| 873 | 'max' => 50, |
| 874 | 'css' => array( array( 'property' => '--jfb-calc-suffix-fz' ) ), |
| 875 | ) |
| 876 | ); |
| 877 | |
| 878 | $this->register_jet_control( |
| 879 | 'calc_fields_suffix_color', |
| 880 | array( |
| 881 | 'tab' => 'style', |
| 882 | 'label' => esc_html__( 'Suffix color', 'jet-form-builder' ), |
| 883 | 'type' => 'color', |
| 884 | 'css' => array( array( 'property' => '--jfb-calc-suffix-color' ) ), |
| 885 | ) |
| 886 | ); |
| 887 | |
| 888 | $this->register_jet_control( |
| 889 | 'calc_fields_bg_color', |
| 890 | array( |
| 891 | 'tab' => 'style', |
| 892 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 893 | 'type' => 'color', |
| 894 | 'css' => array( array( 'property' => '--jfb-calc-bgc' ) ), |
| 895 | ) |
| 896 | ); |
| 897 | |
| 898 | $this->register_jet_control( |
| 899 | 'calc_fields_margin', |
| 900 | array( |
| 901 | 'tab' => 'style', |
| 902 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 903 | 'type' => 'dimensions', |
| 904 | 'css' => array( |
| 905 | array( |
| 906 | 'property' => 'margin', |
| 907 | 'selector' => $css_selector, |
| 908 | ), |
| 909 | ), |
| 910 | ) |
| 911 | ); |
| 912 | |
| 913 | $this->register_jet_control( |
| 914 | 'calc_fields_padding', |
| 915 | array( |
| 916 | 'tab' => 'style', |
| 917 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 918 | 'type' => 'dimensions', |
| 919 | 'css' => array( |
| 920 | array( |
| 921 | 'property' => 'padding', |
| 922 | 'selector' => $css_selector, |
| 923 | ), |
| 924 | ), |
| 925 | ) |
| 926 | ); |
| 927 | |
| 928 | $this->register_jet_control( |
| 929 | 'calc_fields_border', |
| 930 | array( |
| 931 | 'tab' => 'style', |
| 932 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 933 | 'type' => 'border', |
| 934 | 'css' => array( |
| 935 | array( |
| 936 | 'property' => 'border', |
| 937 | 'selector' => $css_selector, |
| 938 | ), |
| 939 | ), |
| 940 | ) |
| 941 | ); |
| 942 | |
| 943 | $this->end_jet_control_group(); |
| 944 | } |
| 945 | // End calculated fields |
| 946 | |
| 947 | // Start range fields |
| 948 | public function control_group_range_fields_style() { |
| 949 | $this->register_jet_control_group( |
| 950 | 'section_range_fields_style', |
| 951 | array( |
| 952 | 'title' => esc_html__( 'Range fields', 'jet-form-builder' ), |
| 953 | 'tab' => 'style', |
| 954 | ) |
| 955 | ); |
| 956 | } |
| 957 | |
| 958 | public function controls_range_fields_style() { |
| 959 | $this->start_jet_control_group( 'section_range_fields_style' ); |
| 960 | |
| 961 | $this->register_jet_control( |
| 962 | 'range_max_width', |
| 963 | array( |
| 964 | 'tab' => 'style', |
| 965 | 'label' => esc_html__( 'Max width', 'jet-form-builder' ), |
| 966 | 'type' => 'number', |
| 967 | 'units' => true, |
| 968 | 'min' => 1, |
| 969 | 'max' => 1000, |
| 970 | 'css' => array( array( 'property' => '--jfb-range-mw' ) ), |
| 971 | ) |
| 972 | ); |
| 973 | |
| 974 | $this->register_jet_control( |
| 975 | 'range_slider_heading', |
| 976 | array( |
| 977 | 'tab' => 'style', |
| 978 | 'type' => 'separator', |
| 979 | 'label' => esc_html__( 'Slider', 'jet-form-builder' ), |
| 980 | ) |
| 981 | ); |
| 982 | |
| 983 | $this->register_jet_control( |
| 984 | 'track_height', |
| 985 | array( |
| 986 | 'tab' => 'style', |
| 987 | 'label' => esc_html__( 'Track height', 'jet-form-builder' ), |
| 988 | 'type' => 'number', |
| 989 | 'units' => true, |
| 990 | 'min' => 1, |
| 991 | 'max' => 20, |
| 992 | 'css' => array( array( 'property' => '--jet-fb__range-field-range--height' ) ), |
| 993 | ) |
| 994 | ); |
| 995 | |
| 996 | $this->register_jet_control( |
| 997 | 'thumb_size', |
| 998 | array( |
| 999 | 'tab' => 'style', |
| 1000 | 'label' => esc_html__( 'Thumb size', 'jet-form-builder' ), |
| 1001 | 'type' => 'number', |
| 1002 | 'units' => true, |
| 1003 | 'min' => 1, |
| 1004 | 'max' => 20, |
| 1005 | 'css' => array( array( 'property' => '--jet-fb__range-field-slider--size' ) ), |
| 1006 | ) |
| 1007 | ); |
| 1008 | |
| 1009 | $this->register_jet_control( |
| 1010 | 'track_border_radius', |
| 1011 | array( |
| 1012 | 'tab' => 'style', |
| 1013 | 'label' => esc_html__( 'Track border radius', 'jet-form-builder' ), |
| 1014 | 'type' => 'number', |
| 1015 | 'units' => true, |
| 1016 | 'min' => 1, |
| 1017 | 'max' => 50, |
| 1018 | 'css' => array( array( 'property' => '--jet-fb__range-field-range--br' ) ), |
| 1019 | ) |
| 1020 | ); |
| 1021 | |
| 1022 | $this->register_jet_control( |
| 1023 | 'thumb_border_radius', |
| 1024 | array( |
| 1025 | 'tab' => 'style', |
| 1026 | 'label' => esc_html__( 'Thumb border radius', 'jet-form-builder' ), |
| 1027 | 'type' => 'number', |
| 1028 | 'units' => true, |
| 1029 | 'min' => 1, |
| 1030 | 'max' => 50, |
| 1031 | 'css' => array( array( 'property' => '--jet-fb__range-field-slider--br' ) ), |
| 1032 | ) |
| 1033 | ); |
| 1034 | |
| 1035 | $this->register_jet_control( |
| 1036 | 'track_bg_color', |
| 1037 | array( |
| 1038 | 'tab' => 'style', |
| 1039 | 'label' => esc_html__( 'Track color', 'jet-form-builder' ), |
| 1040 | 'type' => 'color', |
| 1041 | 'css' => array( array( 'property' => '--jet-fb__range-field-range--bgc' ) ), |
| 1042 | ) |
| 1043 | ); |
| 1044 | |
| 1045 | $this->register_jet_control( |
| 1046 | 'thumb_bg_color', |
| 1047 | array( |
| 1048 | 'tab' => 'style', |
| 1049 | 'label' => esc_html__( 'Thumb color', 'jet-form-builder' ), |
| 1050 | 'type' => 'color', |
| 1051 | 'css' => array( array( 'property' => '--jet-fb__range-field-slider--bgc' ) ), |
| 1052 | ) |
| 1053 | ); |
| 1054 | |
| 1055 | $this->register_jet_control( |
| 1056 | 'range_value_heading', |
| 1057 | array( |
| 1058 | 'tab' => 'style', |
| 1059 | 'type' => 'separator', |
| 1060 | 'label' => esc_html__( 'Value', 'jet-form-builder' ), |
| 1061 | ) |
| 1062 | ); |
| 1063 | |
| 1064 | $this->register_jet_control( |
| 1065 | 'range_value_gap', |
| 1066 | array( |
| 1067 | 'tab' => 'style', |
| 1068 | 'label' => esc_html__( 'Gap', 'jet-form-builder' ), |
| 1069 | 'type' => 'number', |
| 1070 | 'units' => true, |
| 1071 | 'min' => 0, |
| 1072 | 'max' => 40, |
| 1073 | 'css' => array( array( 'property' => '--jfb-range-value-gap' ) ), |
| 1074 | ) |
| 1075 | ); |
| 1076 | |
| 1077 | $this->register_jet_control( |
| 1078 | 'range_value_typography', |
| 1079 | array( |
| 1080 | 'tab' => 'style', |
| 1081 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 1082 | 'type' => 'typography', |
| 1083 | 'css' => array( |
| 1084 | array( |
| 1085 | 'property' => 'typography', |
| 1086 | 'selector' => $this->css_selector( '__field-value.range-value' ), |
| 1087 | ), |
| 1088 | ), |
| 1089 | ) |
| 1090 | ); |
| 1091 | |
| 1092 | $this->register_jet_control( |
| 1093 | 'range_prefix_value_size', |
| 1094 | array( |
| 1095 | 'tab' => 'style', |
| 1096 | 'label' => esc_html__( 'Prefix size', 'jet-form-builder' ), |
| 1097 | 'type' => 'number', |
| 1098 | 'units' => true, |
| 1099 | 'min' => 10, |
| 1100 | 'max' => 50, |
| 1101 | 'css' => array( array( 'property' => '--jfb-range-value-prefix-fz' ) ), |
| 1102 | ) |
| 1103 | ); |
| 1104 | |
| 1105 | $this->register_jet_control( |
| 1106 | 'range_prefix_value_color', |
| 1107 | array( |
| 1108 | 'tab' => 'style', |
| 1109 | 'label' => esc_html__( 'Prefix color', 'jet-form-builder' ), |
| 1110 | 'type' => 'color', |
| 1111 | 'css' => array( array( 'property' => '--jfb-range-value-prefix-color' ) ), |
| 1112 | ) |
| 1113 | ); |
| 1114 | |
| 1115 | $this->register_jet_control( |
| 1116 | 'range_suffix_value_size', |
| 1117 | array( |
| 1118 | 'tab' => 'style', |
| 1119 | 'label' => esc_html__( 'Suffix size', 'jet-form-builder' ), |
| 1120 | 'type' => 'number', |
| 1121 | 'units' => true, |
| 1122 | 'min' => 10, |
| 1123 | 'max' => 50, |
| 1124 | 'css' => array( array( 'property' => '--jfb-range-value-suffix-fz' ) ), |
| 1125 | ) |
| 1126 | ); |
| 1127 | |
| 1128 | $this->register_jet_control( |
| 1129 | 'range_suffix_value_color', |
| 1130 | array( |
| 1131 | 'tab' => 'style', |
| 1132 | 'label' => esc_html__( 'Suffix color', 'jet-form-builder' ), |
| 1133 | 'type' => 'color', |
| 1134 | 'css' => array( array( 'property' => '--jfb-range-value-suffix-color' ) ), |
| 1135 | ) |
| 1136 | ); |
| 1137 | |
| 1138 | $this->end_jet_control_group(); |
| 1139 | } |
| 1140 | // End range fields |
| 1141 | |
| 1142 | // Start heading style |
| 1143 | public function control_group_heading_style() { |
| 1144 | $this->register_jet_control_group( |
| 1145 | 'section_headings_style', |
| 1146 | array( |
| 1147 | 'title' => esc_html__( 'Heading', 'jet-form-builder' ), |
| 1148 | 'tab' => 'style', |
| 1149 | ) |
| 1150 | ); |
| 1151 | } |
| 1152 | |
| 1153 | public function controls_heading_style() { |
| 1154 | $this->start_jet_control_group( 'section_headings_style' ); |
| 1155 | |
| 1156 | $this->register_jet_control( |
| 1157 | 'heading_label_heading', |
| 1158 | array( |
| 1159 | 'tab' => 'style', |
| 1160 | 'type' => 'separator', |
| 1161 | 'label' => esc_html__( 'Label', 'jet-form-builder' ), |
| 1162 | ) |
| 1163 | ); |
| 1164 | |
| 1165 | $css_selectors = array( |
| 1166 | 'label' => $this->css_selector( '__heading' ), |
| 1167 | 'label-text' => $this->css_selector( '__heading' ) . ' ' . $this->css_selector( '__label-text' ), |
| 1168 | 'desc' => $this->css_selector( '__heading-desc' ), |
| 1169 | ); |
| 1170 | |
| 1171 | $this->register_jet_control( |
| 1172 | 'heading_label_typography', |
| 1173 | array( |
| 1174 | 'tab' => 'style', |
| 1175 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 1176 | 'type' => 'typography', |
| 1177 | 'css' => array( |
| 1178 | array( |
| 1179 | 'property' => 'typography', |
| 1180 | 'selector' => $css_selectors['label-text'], |
| 1181 | ), |
| 1182 | ), |
| 1183 | ) |
| 1184 | ); |
| 1185 | |
| 1186 | $this->register_jet_control( |
| 1187 | 'heading_label_bg_color', |
| 1188 | array( |
| 1189 | 'tab' => 'style', |
| 1190 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1191 | 'type' => 'color', |
| 1192 | 'css' => array( array( 'property' => '--jfb-heading-bgc' ) ), |
| 1193 | ) |
| 1194 | ); |
| 1195 | |
| 1196 | $this->register_jet_control( |
| 1197 | 'heading_label_margin', |
| 1198 | array( |
| 1199 | 'tab' => 'style', |
| 1200 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1201 | 'type' => 'dimensions', |
| 1202 | 'css' => array( |
| 1203 | array( |
| 1204 | 'property' => 'margin', |
| 1205 | 'selector' => $css_selectors['label'], |
| 1206 | ), |
| 1207 | ), |
| 1208 | ) |
| 1209 | ); |
| 1210 | |
| 1211 | $this->register_jet_control( |
| 1212 | 'heading_label_padding', |
| 1213 | array( |
| 1214 | 'tab' => 'style', |
| 1215 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1216 | 'type' => 'dimensions', |
| 1217 | 'css' => array( |
| 1218 | array( |
| 1219 | 'property' => 'padding', |
| 1220 | 'selector' => $css_selectors['label'], |
| 1221 | ), |
| 1222 | ), |
| 1223 | ) |
| 1224 | ); |
| 1225 | |
| 1226 | $this->register_jet_control( |
| 1227 | 'heading_label_border', |
| 1228 | array( |
| 1229 | 'tab' => 'style', |
| 1230 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1231 | 'type' => 'border', |
| 1232 | 'css' => array( |
| 1233 | array( |
| 1234 | 'property' => 'border', |
| 1235 | 'selector' => $css_selectors['label'], |
| 1236 | ), |
| 1237 | ), |
| 1238 | ) |
| 1239 | ); |
| 1240 | |
| 1241 | $this->register_jet_control( |
| 1242 | 'heading_desc_heading', |
| 1243 | array( |
| 1244 | 'tab' => 'style', |
| 1245 | 'type' => 'separator', |
| 1246 | 'label' => esc_html__( 'Description', 'jet-form-builder' ), |
| 1247 | ) |
| 1248 | ); |
| 1249 | |
| 1250 | $this->register_jet_control( |
| 1251 | 'heading_desc_typography', |
| 1252 | array( |
| 1253 | 'tab' => 'style', |
| 1254 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 1255 | 'type' => 'typography', |
| 1256 | 'css' => array( |
| 1257 | array( |
| 1258 | 'property' => 'typography', |
| 1259 | 'selector' => $css_selectors['desc'], |
| 1260 | ), |
| 1261 | ), |
| 1262 | ) |
| 1263 | ); |
| 1264 | |
| 1265 | $this->register_jet_control( |
| 1266 | 'heading_desc_bg_color', |
| 1267 | array( |
| 1268 | 'tab' => 'style', |
| 1269 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1270 | 'type' => 'color', |
| 1271 | 'css' => array( array( 'property' => '--jfb-heading-desc-bgc' ) ), |
| 1272 | ) |
| 1273 | ); |
| 1274 | |
| 1275 | $this->register_jet_control( |
| 1276 | 'heading_desc_margin', |
| 1277 | array( |
| 1278 | 'tab' => 'style', |
| 1279 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1280 | 'type' => 'dimensions', |
| 1281 | 'css' => array( |
| 1282 | array( |
| 1283 | 'property' => 'margin', |
| 1284 | 'selector' => $css_selectors['desc'], |
| 1285 | ), |
| 1286 | ), |
| 1287 | ) |
| 1288 | ); |
| 1289 | |
| 1290 | $this->register_jet_control( |
| 1291 | 'heading_desc_padding', |
| 1292 | array( |
| 1293 | 'tab' => 'style', |
| 1294 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1295 | 'type' => 'dimensions', |
| 1296 | 'css' => array( |
| 1297 | array( |
| 1298 | 'property' => 'padding', |
| 1299 | 'selector' => $css_selectors['desc'], |
| 1300 | ), |
| 1301 | ), |
| 1302 | ) |
| 1303 | ); |
| 1304 | |
| 1305 | $this->register_jet_control( |
| 1306 | 'heading_desc_border', |
| 1307 | array( |
| 1308 | 'tab' => 'style', |
| 1309 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1310 | 'type' => 'border', |
| 1311 | 'css' => array( |
| 1312 | array( |
| 1313 | 'property' => 'border', |
| 1314 | 'selector' => $css_selectors['desc'], |
| 1315 | ), |
| 1316 | ), |
| 1317 | ) |
| 1318 | ); |
| 1319 | |
| 1320 | $this->end_jet_control_group(); |
| 1321 | } |
| 1322 | // End heading style |
| 1323 | |
| 1324 | // Start repeater style |
| 1325 | public function control_group_repeater_style() { |
| 1326 | $this->register_jet_control_group( |
| 1327 | 'section_repeater_style', |
| 1328 | array( |
| 1329 | 'title' => esc_html__( 'Repeater', 'jet-form-builder' ), |
| 1330 | 'tab' => 'style', |
| 1331 | ) |
| 1332 | ); |
| 1333 | } |
| 1334 | |
| 1335 | public function controls_repeater_style() { |
| 1336 | $this->start_jet_control_group( 'section_repeater_style' ); |
| 1337 | |
| 1338 | $this->register_jet_control( |
| 1339 | 'repeater_row_heading', |
| 1340 | array( |
| 1341 | 'tab' => 'style', |
| 1342 | 'type' => 'separator', |
| 1343 | 'label' => esc_html__( 'Repeater row', 'jet-form-builder' ), |
| 1344 | ) |
| 1345 | ); |
| 1346 | |
| 1347 | $css_selectors = array( |
| 1348 | 'row' => $this->css_selector( '-repeater__row' ), |
| 1349 | 'new' => $this->css_selector( '-repeater__new' ), |
| 1350 | 'remove' => $this->css_selector( '-repeater__remove' ), |
| 1351 | ); |
| 1352 | |
| 1353 | $this->register_jet_control( |
| 1354 | 'booking_form_repeater_row_padding', |
| 1355 | array( |
| 1356 | 'tab' => 'style', |
| 1357 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1358 | 'type' => 'dimensions', |
| 1359 | 'css' => array( |
| 1360 | array( |
| 1361 | 'property' => 'padding', |
| 1362 | 'selector' => $css_selectors['row'], |
| 1363 | ), |
| 1364 | ), |
| 1365 | ) |
| 1366 | ); |
| 1367 | |
| 1368 | $this->register_jet_control( |
| 1369 | 'repeater_add_button_heading', |
| 1370 | array( |
| 1371 | 'tab' => 'style', |
| 1372 | 'type' => 'separator', |
| 1373 | 'label' => esc_html__( 'New item button', 'jet-form-builder' ), |
| 1374 | ) |
| 1375 | ); |
| 1376 | |
| 1377 | $this->register_jet_control( |
| 1378 | 'booking_form_repeater_align_main_axis', |
| 1379 | array( |
| 1380 | 'tab' => 'style', |
| 1381 | 'label' => esc_html__( 'Align main axis', 'jet-form-builder' ), |
| 1382 | 'type' => 'justify-content', |
| 1383 | 'exclude' => array( |
| 1384 | 'space-between', |
| 1385 | 'space-around', |
| 1386 | 'space-evenly', |
| 1387 | ), |
| 1388 | 'css' => array( array( 'property' => '--jfb-repeater-add-button-justify-content' ) ), |
| 1389 | ) |
| 1390 | ); |
| 1391 | |
| 1392 | $this->register_jet_control( |
| 1393 | 'booking_form_repeater_typography', |
| 1394 | array( |
| 1395 | 'tab' => 'style', |
| 1396 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 1397 | 'type' => 'typography', |
| 1398 | 'css' => array( |
| 1399 | array( |
| 1400 | 'property' => 'typography', |
| 1401 | 'selector' => $css_selectors['new'], |
| 1402 | ), |
| 1403 | ), |
| 1404 | ) |
| 1405 | ); |
| 1406 | |
| 1407 | $this->register_jet_control( |
| 1408 | 'booking_form_repeater_bg_color', |
| 1409 | array( |
| 1410 | 'tab' => 'style', |
| 1411 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1412 | 'type' => 'color', |
| 1413 | 'css' => array( |
| 1414 | array( |
| 1415 | 'property' => 'background-color', |
| 1416 | 'selector' => $css_selectors['new'], |
| 1417 | ), |
| 1418 | ), |
| 1419 | ) |
| 1420 | ); |
| 1421 | |
| 1422 | $this->register_jet_control( |
| 1423 | 'booking_form_repeater_margin', |
| 1424 | array( |
| 1425 | 'tab' => 'style', |
| 1426 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1427 | 'type' => 'dimensions', |
| 1428 | 'css' => array( |
| 1429 | array( |
| 1430 | 'property' => 'margin', |
| 1431 | 'selector' => $css_selectors['new'], |
| 1432 | ), |
| 1433 | ), |
| 1434 | ) |
| 1435 | ); |
| 1436 | |
| 1437 | $this->register_jet_control( |
| 1438 | 'booking_form_repeater_padding', |
| 1439 | array( |
| 1440 | 'tab' => 'style', |
| 1441 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1442 | 'type' => 'dimensions', |
| 1443 | 'css' => array( |
| 1444 | array( |
| 1445 | 'property' => 'padding', |
| 1446 | 'selector' => $css_selectors['new'], |
| 1447 | ), |
| 1448 | ), |
| 1449 | ) |
| 1450 | ); |
| 1451 | |
| 1452 | $this->register_jet_control( |
| 1453 | 'booking_form_repeater_border', |
| 1454 | array( |
| 1455 | 'tab' => 'style', |
| 1456 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1457 | 'type' => 'border', |
| 1458 | 'css' => array( |
| 1459 | array( |
| 1460 | 'property' => 'border', |
| 1461 | 'selector' => $css_selectors['new'], |
| 1462 | ), |
| 1463 | ), |
| 1464 | ) |
| 1465 | ); |
| 1466 | |
| 1467 | $this->register_jet_control( |
| 1468 | 'booking_form_repeater_box_shadow', |
| 1469 | array( |
| 1470 | 'tab' => 'style', |
| 1471 | 'label' => esc_html__( 'Box shadow', 'jet-form-builder' ), |
| 1472 | 'type' => 'box-shadow', |
| 1473 | 'css' => array( |
| 1474 | array( |
| 1475 | 'property' => 'box-shadow', |
| 1476 | 'selector' => $css_selectors['new'], |
| 1477 | ), |
| 1478 | ), |
| 1479 | ) |
| 1480 | ); |
| 1481 | |
| 1482 | $this->register_jet_control( |
| 1483 | 'repeater_rem_button_heading', |
| 1484 | array( |
| 1485 | 'tab' => 'style', |
| 1486 | 'type' => 'separator', |
| 1487 | 'label' => esc_html__( 'Remove item button', 'jet-form-builder' ), |
| 1488 | ) |
| 1489 | ); |
| 1490 | |
| 1491 | $this->register_jet_control( |
| 1492 | 'booking_form_repeater_rem_size', |
| 1493 | array( |
| 1494 | 'tab' => 'style', |
| 1495 | 'label' => esc_html__( 'Icon size', 'jet-form-builder' ), |
| 1496 | 'type' => 'number', |
| 1497 | 'units' => true, |
| 1498 | 'min' => 12, |
| 1499 | 'max' => 90, |
| 1500 | 'css' => array( array( 'property' => '--jfb-repeater-rem-button-fz' ) ), |
| 1501 | ) |
| 1502 | ); |
| 1503 | |
| 1504 | $this->register_jet_control( |
| 1505 | 'booking_form_repeater_rem_color', |
| 1506 | array( |
| 1507 | 'tab' => 'style', |
| 1508 | 'label' => esc_html__( 'Color', 'jet-form-builder' ), |
| 1509 | 'type' => 'color', |
| 1510 | 'css' => array( array( 'property' => '--jfb-repeater-rem-button-color' ) ), |
| 1511 | ) |
| 1512 | ); |
| 1513 | |
| 1514 | $this->register_jet_control( |
| 1515 | 'booking_form_repeater_rem_bg_color', |
| 1516 | array( |
| 1517 | 'tab' => 'style', |
| 1518 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1519 | 'type' => 'color', |
| 1520 | 'css' => array( array( 'property' => '--jfb-repeater-rem-button-bgc' ) ), |
| 1521 | ) |
| 1522 | ); |
| 1523 | |
| 1524 | $this->register_jet_control( |
| 1525 | 'booking_form_repeater_rem_margin', |
| 1526 | array( |
| 1527 | 'tab' => 'style', |
| 1528 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1529 | 'type' => 'dimensions', |
| 1530 | 'css' => array( |
| 1531 | array( |
| 1532 | 'property' => 'margin', |
| 1533 | 'selector' => $css_selectors['remove'], |
| 1534 | ), |
| 1535 | ), |
| 1536 | ) |
| 1537 | ); |
| 1538 | |
| 1539 | $this->register_jet_control( |
| 1540 | 'booking_form_repeater_rem_padding', |
| 1541 | array( |
| 1542 | 'tab' => 'style', |
| 1543 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1544 | 'type' => 'dimensions', |
| 1545 | 'css' => array( |
| 1546 | array( |
| 1547 | 'property' => 'padding', |
| 1548 | 'selector' => $css_selectors['remove'], |
| 1549 | ), |
| 1550 | ), |
| 1551 | ) |
| 1552 | ); |
| 1553 | |
| 1554 | $this->register_jet_control( |
| 1555 | 'booking_form_repeater_rem_border', |
| 1556 | array( |
| 1557 | 'tab' => 'style', |
| 1558 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1559 | 'type' => 'border', |
| 1560 | 'css' => array( |
| 1561 | array( |
| 1562 | 'property' => 'border', |
| 1563 | 'selector' => $css_selectors['remove'], |
| 1564 | ), |
| 1565 | ), |
| 1566 | ) |
| 1567 | ); |
| 1568 | |
| 1569 | $this->register_jet_control( |
| 1570 | 'booking_form_repeater_rem_box_shadow', |
| 1571 | array( |
| 1572 | 'tab' => 'style', |
| 1573 | 'label' => esc_html__( 'Box shadow', 'jet-form-builder' ), |
| 1574 | 'type' => 'box-shadow', |
| 1575 | 'css' => array( |
| 1576 | array( |
| 1577 | 'property' => 'box-shadow', |
| 1578 | 'selector' => $css_selectors['remove'], |
| 1579 | ), |
| 1580 | ), |
| 1581 | ) |
| 1582 | ); |
| 1583 | |
| 1584 | $this->end_jet_control_group(); |
| 1585 | } |
| 1586 | // End repeater style |
| 1587 | |
| 1588 | // Start conditional style |
| 1589 | public function control_group_conditional_style() { |
| 1590 | $this->register_jet_control_group( |
| 1591 | 'section_conditional_style', |
| 1592 | array( |
| 1593 | 'title' => esc_html__( 'Conditional', 'jet-form-builder' ), |
| 1594 | 'tab' => 'style', |
| 1595 | ) |
| 1596 | ); |
| 1597 | } |
| 1598 | |
| 1599 | public function controls_conditional_style() { |
| 1600 | $this->start_jet_control_group( 'section_conditional_style' ); |
| 1601 | |
| 1602 | $this->register_jet_control( |
| 1603 | 'conditional_bg_color', |
| 1604 | array( |
| 1605 | 'tab' => 'style', |
| 1606 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1607 | 'type' => 'color', |
| 1608 | 'css' => array( array( 'property' => '--jfb-conditional-bgc' ) ), |
| 1609 | ) |
| 1610 | ); |
| 1611 | |
| 1612 | $css_selector = $this->css_selector( '__conditional' ); |
| 1613 | |
| 1614 | $this->register_jet_control( |
| 1615 | 'conditional_margin', |
| 1616 | array( |
| 1617 | 'tab' => 'style', |
| 1618 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1619 | 'type' => 'dimensions', |
| 1620 | 'css' => array( |
| 1621 | array( |
| 1622 | 'property' => 'margin', |
| 1623 | 'selector' => $css_selector, |
| 1624 | ), |
| 1625 | ), |
| 1626 | ) |
| 1627 | ); |
| 1628 | |
| 1629 | $this->register_jet_control( |
| 1630 | 'conditional_padding', |
| 1631 | array( |
| 1632 | 'tab' => 'style', |
| 1633 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1634 | 'type' => 'dimensions', |
| 1635 | 'css' => array( |
| 1636 | array( |
| 1637 | 'property' => 'padding', |
| 1638 | 'selector' => $css_selector, |
| 1639 | ), |
| 1640 | ), |
| 1641 | ) |
| 1642 | ); |
| 1643 | |
| 1644 | $this->register_jet_control( |
| 1645 | 'conditional_border', |
| 1646 | array( |
| 1647 | 'tab' => 'style', |
| 1648 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1649 | 'type' => 'border', |
| 1650 | 'css' => array( |
| 1651 | array( |
| 1652 | 'property' => 'border', |
| 1653 | 'selector' => $css_selector, |
| 1654 | ), |
| 1655 | ), |
| 1656 | ) |
| 1657 | ); |
| 1658 | |
| 1659 | $this->end_jet_control_group(); |
| 1660 | } |
| 1661 | // End conditional style |
| 1662 | |
| 1663 | // Start submit style |
| 1664 | public function control_group_submit_style() { |
| 1665 | $this->register_jet_control_group( |
| 1666 | 'section_submit_style', |
| 1667 | array( |
| 1668 | 'title' => esc_html__( 'Submit', 'jet-form-builder' ), |
| 1669 | 'tab' => 'style', |
| 1670 | ) |
| 1671 | ); |
| 1672 | } |
| 1673 | |
| 1674 | public function controls_submit_style() { |
| 1675 | $this->start_jet_control_group( 'section_submit_style' ); |
| 1676 | |
| 1677 | $this->register_jet_control( |
| 1678 | 'booking_form_submit_align_main_axis', |
| 1679 | array( |
| 1680 | 'tab' => 'style', |
| 1681 | 'label' => esc_html__( 'Align main axis', 'jet-form-builder' ), |
| 1682 | 'type' => 'justify-content', |
| 1683 | 'exclude' => array( |
| 1684 | 'space-between', |
| 1685 | 'space-around', |
| 1686 | 'space-evenly', |
| 1687 | ), |
| 1688 | 'css' => array( array( 'property' => '--jfb-submit-justify-content' ) ), |
| 1689 | ) |
| 1690 | ); |
| 1691 | |
| 1692 | $this->register_jet_control( |
| 1693 | 'booking_form_submit_width', |
| 1694 | array( |
| 1695 | 'tab' => 'style', |
| 1696 | 'label' => esc_html__( 'Width', 'jet-form-builder' ), |
| 1697 | 'type' => 'number', |
| 1698 | 'units' => true, |
| 1699 | 'min' => 1, |
| 1700 | 'max' => 1000, |
| 1701 | 'css' => array( array( 'property' => '--jfb-submit-w' ) ), |
| 1702 | ) |
| 1703 | ); |
| 1704 | |
| 1705 | $css_selector = $this->css_selector( '__submit' ); |
| 1706 | |
| 1707 | $this->register_jet_control( |
| 1708 | 'booking_form_submit_typography', |
| 1709 | array( |
| 1710 | 'tab' => 'style', |
| 1711 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 1712 | 'type' => 'typography', |
| 1713 | 'css' => array( |
| 1714 | array( |
| 1715 | 'property' => 'typography', |
| 1716 | 'selector' => $css_selector, |
| 1717 | ), |
| 1718 | ), |
| 1719 | ) |
| 1720 | ); |
| 1721 | |
| 1722 | $this->register_jet_control( |
| 1723 | 'booking_form_submit_bg_color', |
| 1724 | array( |
| 1725 | 'tab' => 'style', |
| 1726 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1727 | 'type' => 'color', |
| 1728 | 'css' => array( |
| 1729 | array( |
| 1730 | 'property' => 'background-color', |
| 1731 | 'selector' => $css_selector, |
| 1732 | ), |
| 1733 | ), |
| 1734 | ) |
| 1735 | ); |
| 1736 | |
| 1737 | $this->register_jet_control( |
| 1738 | 'booking_form_submit_margin', |
| 1739 | array( |
| 1740 | 'tab' => 'style', |
| 1741 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1742 | 'type' => 'dimensions', |
| 1743 | 'css' => array( |
| 1744 | array( |
| 1745 | 'property' => 'margin', |
| 1746 | 'selector' => $css_selector, |
| 1747 | ), |
| 1748 | ), |
| 1749 | ) |
| 1750 | ); |
| 1751 | |
| 1752 | $this->register_jet_control( |
| 1753 | 'booking_form_submit_padding', |
| 1754 | array( |
| 1755 | 'tab' => 'style', |
| 1756 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1757 | 'type' => 'dimensions', |
| 1758 | 'css' => array( |
| 1759 | array( |
| 1760 | 'property' => 'padding', |
| 1761 | 'selector' => $css_selector, |
| 1762 | ), |
| 1763 | ), |
| 1764 | ) |
| 1765 | ); |
| 1766 | |
| 1767 | $this->register_jet_control( |
| 1768 | 'booking_form_submit_border', |
| 1769 | array( |
| 1770 | 'tab' => 'style', |
| 1771 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1772 | 'type' => 'border', |
| 1773 | 'css' => array( |
| 1774 | array( |
| 1775 | 'property' => 'border', |
| 1776 | 'selector' => $css_selector, |
| 1777 | ), |
| 1778 | ), |
| 1779 | ) |
| 1780 | ); |
| 1781 | |
| 1782 | $this->register_jet_control( |
| 1783 | 'booking_form_submit_box_shadow', |
| 1784 | array( |
| 1785 | 'tab' => 'style', |
| 1786 | 'label' => esc_html__( 'Box shadow', 'jet-form-builder' ), |
| 1787 | 'type' => 'box-shadow', |
| 1788 | 'css' => array( |
| 1789 | array( |
| 1790 | 'property' => 'box-shadow', |
| 1791 | 'selector' => $css_selector, |
| 1792 | ), |
| 1793 | ), |
| 1794 | ) |
| 1795 | ); |
| 1796 | |
| 1797 | $this->end_jet_control_group(); |
| 1798 | } |
| 1799 | // End label style |
| 1800 | |
| 1801 | // Start form break style |
| 1802 | public function control_group_form_break_style() { |
| 1803 | $this->register_jet_control_group( |
| 1804 | 'section_form_break_style', |
| 1805 | array( |
| 1806 | 'title' => esc_html__( 'Form Break Row', 'jet-form-builder' ), |
| 1807 | 'tab' => 'style', |
| 1808 | ) |
| 1809 | ); |
| 1810 | } |
| 1811 | |
| 1812 | public function controls_form_break_style() { |
| 1813 | $this->start_jet_control_group( 'section_form_break_style' ); |
| 1814 | |
| 1815 | $this->register_jet_control( |
| 1816 | 'form_break_notice', |
| 1817 | array( |
| 1818 | 'tab' => 'content', |
| 1819 | 'content' => esc_html__( 'Styles from this tab apply to the Next Page and Prev Page controls added through the Form Page Break block.', 'jet-form-builder' ), |
| 1820 | 'type' => 'info', |
| 1821 | ) |
| 1822 | ); |
| 1823 | |
| 1824 | $this->register_jet_control( |
| 1825 | 'form_break_alignment', |
| 1826 | array( |
| 1827 | 'tab' => 'style', |
| 1828 | 'label' => esc_html__( 'Text align', 'jet-form-builder' ), |
| 1829 | 'type' => 'text-align', |
| 1830 | 'css' => array( array( 'property' => '--jfb-break-text-align' ) ), |
| 1831 | ) |
| 1832 | ); |
| 1833 | |
| 1834 | $css_selector = $this->css_selector( '__next-page-wrap' ); |
| 1835 | |
| 1836 | $this->register_jet_control( |
| 1837 | 'form_break_padding', |
| 1838 | array( |
| 1839 | 'tab' => 'style', |
| 1840 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1841 | 'type' => 'dimensions', |
| 1842 | 'css' => array( |
| 1843 | array( |
| 1844 | 'property' => 'padding', |
| 1845 | 'selector' => $css_selector, |
| 1846 | ), |
| 1847 | ), |
| 1848 | ) |
| 1849 | ); |
| 1850 | |
| 1851 | $this->register_jet_control( |
| 1852 | 'form_break_border', |
| 1853 | array( |
| 1854 | 'tab' => 'style', |
| 1855 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1856 | 'type' => 'border', |
| 1857 | 'css' => array( |
| 1858 | array( |
| 1859 | 'property' => 'border', |
| 1860 | 'selector' => $css_selector, |
| 1861 | ), |
| 1862 | ), |
| 1863 | ) |
| 1864 | ); |
| 1865 | |
| 1866 | $this->end_jet_control_group(); |
| 1867 | } |
| 1868 | // End form break style |
| 1869 | |
| 1870 | // Start form break buttons style |
| 1871 | public function control_group_form_break_buttons_style() { |
| 1872 | $this->register_jet_control_group( |
| 1873 | 'section_form_break_next_style', |
| 1874 | array( |
| 1875 | 'title' => esc_html__( 'Form Break Buttons', 'jet-form-builder' ), |
| 1876 | 'tab' => 'style', |
| 1877 | ) |
| 1878 | ); |
| 1879 | } |
| 1880 | |
| 1881 | public function controls_form_break_buttons_style() { |
| 1882 | $this->start_jet_control_group( 'section_form_break_next_style' ); |
| 1883 | |
| 1884 | $css_selectors = array( |
| 1885 | 'prev' => $this->css_selector( '__prev-page' ), |
| 1886 | 'next' => $this->css_selector( '__next-page' ), |
| 1887 | ); |
| 1888 | |
| 1889 | $this->register_jet_control( |
| 1890 | 'form_break_next_notice', |
| 1891 | array( |
| 1892 | 'tab' => 'content', |
| 1893 | 'content' => esc_html__( 'The styles from this tab apply to the Next Page and Prev Page added as separate blocks in the form.', 'jet-form-builder' ), |
| 1894 | 'type' => 'info', |
| 1895 | ) |
| 1896 | ); |
| 1897 | |
| 1898 | $this->register_jet_control( |
| 1899 | 'form_break_button_typography', |
| 1900 | array( |
| 1901 | 'tab' => 'style', |
| 1902 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 1903 | 'type' => 'typography', |
| 1904 | 'css' => array( |
| 1905 | array( |
| 1906 | 'property' => 'typography', |
| 1907 | 'selector' => $css_selectors['prev'], |
| 1908 | ), |
| 1909 | array( |
| 1910 | 'property' => 'typography', |
| 1911 | 'selector' => $css_selectors['next'], |
| 1912 | ), |
| 1913 | ), |
| 1914 | ) |
| 1915 | ); |
| 1916 | |
| 1917 | $this->register_jet_control( |
| 1918 | 'form_break_button_bg_color', |
| 1919 | array( |
| 1920 | 'tab' => 'style', |
| 1921 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 1922 | 'type' => 'color', |
| 1923 | 'css' => array( |
| 1924 | array( |
| 1925 | 'property' => 'background-color', |
| 1926 | 'selector' => $css_selectors['prev'], |
| 1927 | ), |
| 1928 | array( |
| 1929 | 'property' => 'background-color', |
| 1930 | 'selector' => $css_selectors['next'], |
| 1931 | ), |
| 1932 | ), |
| 1933 | ) |
| 1934 | ); |
| 1935 | |
| 1936 | $this->register_jet_control( |
| 1937 | 'form_break_button_margin', |
| 1938 | array( |
| 1939 | 'tab' => 'style', |
| 1940 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 1941 | 'type' => 'dimensions', |
| 1942 | 'css' => array( |
| 1943 | array( |
| 1944 | 'property' => 'margin', |
| 1945 | 'selector' => $css_selectors['prev'], |
| 1946 | ), |
| 1947 | array( |
| 1948 | 'property' => 'margin', |
| 1949 | 'selector' => $css_selectors['next'], |
| 1950 | ), |
| 1951 | ), |
| 1952 | ) |
| 1953 | ); |
| 1954 | |
| 1955 | $this->register_jet_control( |
| 1956 | 'form_break_button_padding', |
| 1957 | array( |
| 1958 | 'tab' => 'style', |
| 1959 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 1960 | 'type' => 'dimensions', |
| 1961 | 'css' => array( |
| 1962 | array( |
| 1963 | 'property' => 'padding', |
| 1964 | 'selector' => $css_selectors['prev'], |
| 1965 | ), |
| 1966 | array( |
| 1967 | 'property' => 'padding', |
| 1968 | 'selector' => $css_selectors['next'], |
| 1969 | ), |
| 1970 | ), |
| 1971 | ) |
| 1972 | ); |
| 1973 | |
| 1974 | $this->register_jet_control( |
| 1975 | 'form_break_button_border', |
| 1976 | array( |
| 1977 | 'tab' => 'style', |
| 1978 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 1979 | 'type' => 'border', |
| 1980 | 'css' => array( |
| 1981 | array( |
| 1982 | 'property' => 'border', |
| 1983 | 'selector' => $css_selectors['prev'], |
| 1984 | ), |
| 1985 | array( |
| 1986 | 'property' => 'border', |
| 1987 | 'selector' => $css_selectors['next'], |
| 1988 | ), |
| 1989 | ), |
| 1990 | ) |
| 1991 | ); |
| 1992 | |
| 1993 | $this->end_jet_control_group(); |
| 1994 | } |
| 1995 | // End form break buttons style |
| 1996 | |
| 1997 | // Start form break disabled message style |
| 1998 | public function control_group_form_break_message_style() { |
| 1999 | $this->register_jet_control_group( |
| 2000 | 'section_form_break_message_style', |
| 2001 | array( |
| 2002 | 'title' => esc_html__( 'Form Break Disabled Message', 'jet-form-builder' ), |
| 2003 | 'tab' => 'style', |
| 2004 | ) |
| 2005 | ); |
| 2006 | } |
| 2007 | |
| 2008 | public function controls_form_break_message_style() { |
| 2009 | $this->start_jet_control_group( 'section_form_break_message_style' ); |
| 2010 | |
| 2011 | $css_selector = $this->css_selector( '__next-page-msg' ); |
| 2012 | |
| 2013 | $this->register_jet_control( |
| 2014 | 'form_break_message_typography', |
| 2015 | array( |
| 2016 | 'tab' => 'style', |
| 2017 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 2018 | 'type' => 'typography', |
| 2019 | 'css' => array( |
| 2020 | array( |
| 2021 | 'property' => 'typography', |
| 2022 | 'selector' => $css_selector, |
| 2023 | ), |
| 2024 | ), |
| 2025 | ) |
| 2026 | ); |
| 2027 | |
| 2028 | $this->register_jet_control( |
| 2029 | 'form_break_message_bg_color', |
| 2030 | array( |
| 2031 | 'tab' => 'style', |
| 2032 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2033 | 'type' => 'color', |
| 2034 | 'css' => array( array( 'property' => '--jfb-break-message-bgc' ) ), |
| 2035 | ) |
| 2036 | ); |
| 2037 | |
| 2038 | $this->register_jet_control( |
| 2039 | 'form_break_message_margin', |
| 2040 | array( |
| 2041 | 'tab' => 'style', |
| 2042 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2043 | 'type' => 'dimensions', |
| 2044 | 'css' => array( |
| 2045 | array( |
| 2046 | 'property' => 'margin', |
| 2047 | 'selector' => $css_selector, |
| 2048 | ), |
| 2049 | ), |
| 2050 | ) |
| 2051 | ); |
| 2052 | |
| 2053 | $this->register_jet_control( |
| 2054 | 'form_break_message_padding', |
| 2055 | array( |
| 2056 | 'tab' => 'style', |
| 2057 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2058 | 'type' => 'dimensions', |
| 2059 | 'css' => array( |
| 2060 | array( |
| 2061 | 'property' => 'padding', |
| 2062 | 'selector' => $css_selector, |
| 2063 | ), |
| 2064 | ), |
| 2065 | ) |
| 2066 | ); |
| 2067 | |
| 2068 | $this->register_jet_control( |
| 2069 | 'form_break_message_border', |
| 2070 | array( |
| 2071 | 'tab' => 'style', |
| 2072 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2073 | 'type' => 'border', |
| 2074 | 'css' => array( |
| 2075 | array( |
| 2076 | 'property' => 'border', |
| 2077 | 'selector' => $css_selector, |
| 2078 | ), |
| 2079 | ), |
| 2080 | ) |
| 2081 | ); |
| 2082 | |
| 2083 | $this->end_jet_control_group(); |
| 2084 | } |
| 2085 | // End form break disabled message style |
| 2086 | |
| 2087 | // Start progress wrap |
| 2088 | public function control_group_form_progress_wrap_style() { |
| 2089 | $this->register_jet_control_group( |
| 2090 | 'jet_fb_progress_wrapper_section', |
| 2091 | array( |
| 2092 | 'title' => esc_html__( 'Form Progress - Wrapper', 'jet-form-builder' ), |
| 2093 | 'tab' => 'style', |
| 2094 | ) |
| 2095 | ); |
| 2096 | } |
| 2097 | |
| 2098 | public function controls_form_progress_wrap_style() { |
| 2099 | $this->start_jet_control_group( 'jet_fb_progress_wrapper_section' ); |
| 2100 | |
| 2101 | $this->register_jet_control( |
| 2102 | 'jet_fb_progress_wrapper_bg_color', |
| 2103 | array( |
| 2104 | 'tab' => 'style', |
| 2105 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2106 | 'type' => 'color', |
| 2107 | 'css' => array( array( 'property' => '--jfb-progress-wrapper-bgc' ) ), |
| 2108 | ) |
| 2109 | ); |
| 2110 | |
| 2111 | $css_selector = $this->css_selector( '-progress-pages' ); |
| 2112 | |
| 2113 | $this->register_jet_control( |
| 2114 | 'jet_fb_progress_wrapper_margin', |
| 2115 | array( |
| 2116 | 'tab' => 'style', |
| 2117 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2118 | 'type' => 'dimensions', |
| 2119 | 'css' => array( |
| 2120 | array( |
| 2121 | 'property' => 'margin', |
| 2122 | 'selector' => $css_selector, |
| 2123 | ), |
| 2124 | ), |
| 2125 | ) |
| 2126 | ); |
| 2127 | |
| 2128 | $this->register_jet_control( |
| 2129 | 'jet_fb_progress_wrapper_padding', |
| 2130 | array( |
| 2131 | 'tab' => 'style', |
| 2132 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2133 | 'type' => 'dimensions', |
| 2134 | 'css' => array( |
| 2135 | array( |
| 2136 | 'property' => 'padding', |
| 2137 | 'selector' => $css_selector, |
| 2138 | ), |
| 2139 | ), |
| 2140 | ) |
| 2141 | ); |
| 2142 | |
| 2143 | $this->register_jet_control( |
| 2144 | 'jet_fb_progress_wrapper_border', |
| 2145 | array( |
| 2146 | 'tab' => 'style', |
| 2147 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2148 | 'type' => 'border', |
| 2149 | 'css' => array( |
| 2150 | array( |
| 2151 | 'property' => 'border', |
| 2152 | 'selector' => $css_selector, |
| 2153 | ), |
| 2154 | ), |
| 2155 | ) |
| 2156 | ); |
| 2157 | |
| 2158 | $this->end_jet_control_group(); |
| 2159 | } |
| 2160 | // End progress wrap |
| 2161 | |
| 2162 | // Start progress pages |
| 2163 | public function control_group_form_progress_pages_style() { |
| 2164 | $this->register_jet_control_group( |
| 2165 | 'jet_fb_progress_pages_section', |
| 2166 | array( |
| 2167 | 'title' => esc_html__( 'Form Progress - Pages', 'jet-form-builder' ), |
| 2168 | 'tab' => 'style', |
| 2169 | ) |
| 2170 | ); |
| 2171 | } |
| 2172 | |
| 2173 | public function controls_form_progress_pages_style() { |
| 2174 | $this->start_jet_control_group( 'jet_fb_progress_pages_section' ); |
| 2175 | |
| 2176 | $css_selectors = array( |
| 2177 | 'wrapper' => $this->css_selector( '-progress-pages__item--wrapper' ), |
| 2178 | 'item' => $this->css_selector( '-progress-pages__item' ), |
| 2179 | 'circle' => $this->css_selector( '-progress-pages__item--circle' ), |
| 2180 | 'passed-page' => $this->css_selector( '-progress-pages__item--wrapper.passed-page' ), |
| 2181 | 'active-page' => $this->css_selector( '-progress-pages__item--wrapper.active-page' ), |
| 2182 | ); |
| 2183 | |
| 2184 | $this->register_jet_control( |
| 2185 | 'jet_fb_progress_wrapper_typography', |
| 2186 | array( |
| 2187 | 'tab' => 'style', |
| 2188 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 2189 | 'type' => 'typography', |
| 2190 | 'css' => array( |
| 2191 | array( |
| 2192 | 'property' => 'typography', |
| 2193 | 'selector' => $css_selectors['wrapper'], |
| 2194 | ), |
| 2195 | ), |
| 2196 | ) |
| 2197 | ); |
| 2198 | |
| 2199 | $this->register_jet_control( |
| 2200 | 'jet_fb_progress_pages_bg_color', |
| 2201 | array( |
| 2202 | 'tab' => 'style', |
| 2203 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2204 | 'type' => 'color', |
| 2205 | 'css' => array( array( 'property' => '--jfb-progress-default-page-bgc' ) ), |
| 2206 | ) |
| 2207 | ); |
| 2208 | |
| 2209 | $this->register_jet_control( |
| 2210 | 'jet_fb_progress_pages_margin', |
| 2211 | array( |
| 2212 | 'tab' => 'style', |
| 2213 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2214 | 'type' => 'dimensions', |
| 2215 | 'css' => array( |
| 2216 | array( |
| 2217 | 'property' => 'margin', |
| 2218 | 'selector' => $css_selectors['item'], |
| 2219 | ), |
| 2220 | ), |
| 2221 | ) |
| 2222 | ); |
| 2223 | |
| 2224 | $this->register_jet_control( |
| 2225 | 'jet_fb_progress_pages_padding', |
| 2226 | array( |
| 2227 | 'tab' => 'style', |
| 2228 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2229 | 'type' => 'dimensions', |
| 2230 | 'css' => array( |
| 2231 | array( |
| 2232 | 'property' => 'padding', |
| 2233 | 'selector' => $css_selectors['item'], |
| 2234 | ), |
| 2235 | ), |
| 2236 | ) |
| 2237 | ); |
| 2238 | |
| 2239 | $this->register_jet_control( |
| 2240 | 'jet_fb_progress_pages_border', |
| 2241 | array( |
| 2242 | 'tab' => 'style', |
| 2243 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2244 | 'type' => 'border', |
| 2245 | 'css' => array( |
| 2246 | array( |
| 2247 | 'property' => 'border', |
| 2248 | 'selector' => $css_selectors['item'], |
| 2249 | ), |
| 2250 | ), |
| 2251 | ) |
| 2252 | ); |
| 2253 | |
| 2254 | $this->register_jet_control( |
| 2255 | 'jet_fb_progress_separator_height', |
| 2256 | array( |
| 2257 | 'tab' => 'style', |
| 2258 | 'label' => esc_html__( 'Separator height', 'jet-form-builder' ), |
| 2259 | 'type' => 'number', |
| 2260 | 'units' => true, |
| 2261 | 'min' => 1, |
| 2262 | 'max' => 100, |
| 2263 | 'css' => array( array( 'property' => '--jfb-progress-default-page-separator-h' ) ), |
| 2264 | ) |
| 2265 | ); |
| 2266 | |
| 2267 | $this->register_jet_control( |
| 2268 | 'jet_fb_progress_separator_color', |
| 2269 | array( |
| 2270 | 'tab' => 'style', |
| 2271 | 'label' => esc_html__( 'Separator color', 'jet-form-builder' ), |
| 2272 | 'type' => 'color', |
| 2273 | 'css' => array( array( 'property' => '--jfb-progress-default-page-separator-color' ) ), |
| 2274 | ) |
| 2275 | ); |
| 2276 | |
| 2277 | $this->register_jet_control( |
| 2278 | 'jet_fb_progress_circle_border', |
| 2279 | array( |
| 2280 | 'tab' => 'style', |
| 2281 | 'label' => esc_html__( 'Circle border', 'jet-form-builder' ), |
| 2282 | 'type' => 'border', |
| 2283 | 'css' => array( |
| 2284 | array( |
| 2285 | 'property' => 'border', |
| 2286 | 'selector' => $css_selectors['circle'], |
| 2287 | ), |
| 2288 | ), |
| 2289 | ) |
| 2290 | ); |
| 2291 | |
| 2292 | $this->register_jet_control( |
| 2293 | 'jet_fb_progress_passed_page_heading', |
| 2294 | array( |
| 2295 | 'tab' => 'style', |
| 2296 | 'type' => 'separator', |
| 2297 | 'label' => esc_html__( 'Passed page', 'jet-form-builder' ), |
| 2298 | ) |
| 2299 | ); |
| 2300 | |
| 2301 | $this->register_jet_control( |
| 2302 | 'jet_fb_progress_passed_page_color', |
| 2303 | array( |
| 2304 | 'tab' => 'style', |
| 2305 | 'label' => esc_html__( 'Color', 'jet-form-builder' ), |
| 2306 | 'type' => 'color', |
| 2307 | 'css' => array( |
| 2308 | array( |
| 2309 | 'property' => 'color', |
| 2310 | 'selector' => $css_selectors['passed-page'], |
| 2311 | ), |
| 2312 | ), |
| 2313 | ) |
| 2314 | ); |
| 2315 | |
| 2316 | $this->register_jet_control( |
| 2317 | 'jet_fb_progress_passed_page_bg_color', |
| 2318 | array( |
| 2319 | 'tab' => 'style', |
| 2320 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2321 | 'type' => 'color', |
| 2322 | 'css' => array( array( 'property' => '--jfb-progress-passed-page-bgc' ) ), |
| 2323 | ) |
| 2324 | ); |
| 2325 | |
| 2326 | $this->register_jet_control( |
| 2327 | 'jet_fb_progress_passed_page_border_color', |
| 2328 | array( |
| 2329 | 'tab' => 'style', |
| 2330 | 'label' => esc_html__( 'Border color', 'jet-form-builder' ), |
| 2331 | 'type' => 'color', |
| 2332 | 'css' => array( |
| 2333 | array( |
| 2334 | 'property' => 'border-color', |
| 2335 | 'selector' => '.passed-page ' . $css_selectors['item'], |
| 2336 | ), |
| 2337 | ), |
| 2338 | ) |
| 2339 | ); |
| 2340 | |
| 2341 | $this->register_jet_control( |
| 2342 | 'jet_fb_progress_passed_page_separator_height', |
| 2343 | array( |
| 2344 | 'tab' => 'style', |
| 2345 | 'label' => esc_html__( 'Separator height', 'jet-form-builder' ), |
| 2346 | 'type' => 'number', |
| 2347 | 'units' => true, |
| 2348 | 'min' => 1, |
| 2349 | 'max' => 100, |
| 2350 | 'css' => array( array( 'property' => '--jfb-progress-passed-page-separator-h' ) ), |
| 2351 | ) |
| 2352 | ); |
| 2353 | |
| 2354 | $this->register_jet_control( |
| 2355 | 'jet_fb_progress_passed_page_separator_color', |
| 2356 | array( |
| 2357 | 'tab' => 'style', |
| 2358 | 'label' => esc_html__( 'Separator color', 'jet-form-builder' ), |
| 2359 | 'type' => 'color', |
| 2360 | 'css' => array( array( 'property' => '--jfb-progress-passed-page-separator-color' ) ), |
| 2361 | ) |
| 2362 | ); |
| 2363 | |
| 2364 | $this->register_jet_control( |
| 2365 | 'jet_fb_progress_passed_page_circle_border_color', |
| 2366 | array( |
| 2367 | 'tab' => 'style', |
| 2368 | 'label' => esc_html__( 'Circle border color', 'jet-form-builder' ), |
| 2369 | 'type' => 'color', |
| 2370 | 'css' => array( |
| 2371 | array( |
| 2372 | 'property' => 'border-color', |
| 2373 | 'selector' => '.passed-page ' . $css_selectors['circle'], |
| 2374 | ), |
| 2375 | ), |
| 2376 | ) |
| 2377 | ); |
| 2378 | |
| 2379 | $this->register_jet_control( |
| 2380 | 'jet_fb_progress_active_page_heading', |
| 2381 | array( |
| 2382 | 'tab' => 'style', |
| 2383 | 'type' => 'separator', |
| 2384 | 'label' => esc_html__( 'Active page', 'jet-form-builder' ), |
| 2385 | ) |
| 2386 | ); |
| 2387 | |
| 2388 | $this->register_jet_control( |
| 2389 | 'jet_fb_progress_active_page_color', |
| 2390 | array( |
| 2391 | 'tab' => 'style', |
| 2392 | 'label' => esc_html__( 'Color', 'jet-form-builder' ), |
| 2393 | 'type' => 'color', |
| 2394 | 'css' => array( |
| 2395 | array( |
| 2396 | 'property' => 'color', |
| 2397 | 'selector' => $css_selectors['active-page'], |
| 2398 | ), |
| 2399 | ), |
| 2400 | ) |
| 2401 | ); |
| 2402 | |
| 2403 | $this->register_jet_control( |
| 2404 | 'jet_fb_progress_active_page_bg_color', |
| 2405 | array( |
| 2406 | 'tab' => 'style', |
| 2407 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2408 | 'type' => 'color', |
| 2409 | 'css' => array( array( 'property' => '--jfb-progress-active-page-bgc' ) ), |
| 2410 | ) |
| 2411 | ); |
| 2412 | |
| 2413 | $this->register_jet_control( |
| 2414 | 'jet_fb_progress_active_page_border_color', |
| 2415 | array( |
| 2416 | 'tab' => 'style', |
| 2417 | 'label' => esc_html__( 'Border color', 'jet-form-builder' ), |
| 2418 | 'type' => 'color', |
| 2419 | 'css' => array( |
| 2420 | array( |
| 2421 | 'property' => 'border-color', |
| 2422 | 'selector' => '.active-page ' . $css_selectors['item'], |
| 2423 | ), |
| 2424 | ), |
| 2425 | ) |
| 2426 | ); |
| 2427 | |
| 2428 | $this->register_jet_control( |
| 2429 | 'jet_fb_progress_active_page_separator_height', |
| 2430 | array( |
| 2431 | 'tab' => 'style', |
| 2432 | 'label' => esc_html__( 'Separator height', 'jet-form-builder' ), |
| 2433 | 'type' => 'number', |
| 2434 | 'units' => true, |
| 2435 | 'min' => 1, |
| 2436 | 'max' => 100, |
| 2437 | 'css' => array( array( 'property' => '--jfb-progress-active-page-separator-h' ) ), |
| 2438 | ) |
| 2439 | ); |
| 2440 | |
| 2441 | $this->register_jet_control( |
| 2442 | 'jet_fb_progress_active_page_separator_color', |
| 2443 | array( |
| 2444 | 'tab' => 'style', |
| 2445 | 'label' => esc_html__( 'Separator color', 'jet-form-builder' ), |
| 2446 | 'type' => 'color', |
| 2447 | 'css' => array( array( 'property' => '--jfb-progress-active-page-separator-color' ) ), |
| 2448 | ) |
| 2449 | ); |
| 2450 | |
| 2451 | $this->register_jet_control( |
| 2452 | 'jet_fb_progress_active_page_circle_border_color', |
| 2453 | array( |
| 2454 | 'tab' => 'style', |
| 2455 | 'label' => esc_html__( 'Circle border color', 'jet-form-builder' ), |
| 2456 | 'type' => 'color', |
| 2457 | 'css' => array( |
| 2458 | array( |
| 2459 | 'property' => 'border-color', |
| 2460 | 'selector' => '.active-page ' . $css_selectors['circle'], |
| 2461 | ), |
| 2462 | ), |
| 2463 | ) |
| 2464 | ); |
| 2465 | |
| 2466 | $this->end_jet_control_group(); |
| 2467 | } |
| 2468 | // End progress pages |
| 2469 | |
| 2470 | // Start message style |
| 2471 | public function control_group_message_style() { |
| 2472 | $this->register_jet_control_group( |
| 2473 | 'section_message_style', |
| 2474 | array( |
| 2475 | 'title' => esc_html__( 'Messages', 'jet-form-builder' ), |
| 2476 | 'tab' => 'style', |
| 2477 | ) |
| 2478 | ); |
| 2479 | } |
| 2480 | |
| 2481 | public function controls_message_style() { |
| 2482 | $this->start_jet_control_group( 'section_message_style' ); |
| 2483 | |
| 2484 | $css_selectors = array( |
| 2485 | 'success' => $this->css_selector( '-message--success' ), |
| 2486 | 'error' => $this->css_selector( '-message--error' ), |
| 2487 | ); |
| 2488 | |
| 2489 | $this->register_jet_control( |
| 2490 | 'message_margin', |
| 2491 | array( |
| 2492 | 'tab' => 'style', |
| 2493 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2494 | 'type' => 'dimensions', |
| 2495 | 'css' => array( |
| 2496 | array( |
| 2497 | 'property' => 'margin', |
| 2498 | 'selector' => $css_selectors['success'], |
| 2499 | ), |
| 2500 | array( |
| 2501 | 'property' => 'margin', |
| 2502 | 'selector' => $css_selectors['error'], |
| 2503 | ), |
| 2504 | ), |
| 2505 | ) |
| 2506 | ); |
| 2507 | |
| 2508 | $this->register_jet_control( |
| 2509 | 'message_padding', |
| 2510 | array( |
| 2511 | 'tab' => 'style', |
| 2512 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2513 | 'type' => 'dimensions', |
| 2514 | 'css' => array( |
| 2515 | array( |
| 2516 | 'property' => 'padding', |
| 2517 | 'selector' => $css_selectors['success'], |
| 2518 | ), |
| 2519 | array( |
| 2520 | 'property' => 'padding', |
| 2521 | 'selector' => $css_selectors['error'], |
| 2522 | ), |
| 2523 | ), |
| 2524 | ) |
| 2525 | ); |
| 2526 | |
| 2527 | $this->register_jet_control( |
| 2528 | 'message_success_heading', |
| 2529 | array( |
| 2530 | 'tab' => 'style', |
| 2531 | 'type' => 'separator', |
| 2532 | 'label' => esc_html__( 'Success message', 'jet-form-builder' ), |
| 2533 | ) |
| 2534 | ); |
| 2535 | |
| 2536 | $this->register_jet_control( |
| 2537 | 'message_success_typography', |
| 2538 | array( |
| 2539 | 'tab' => 'style', |
| 2540 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 2541 | 'type' => 'typography', |
| 2542 | 'css' => array( |
| 2543 | array( |
| 2544 | 'property' => 'typography', |
| 2545 | 'selector' => $css_selectors['success'], |
| 2546 | ), |
| 2547 | ), |
| 2548 | ) |
| 2549 | ); |
| 2550 | |
| 2551 | $this->register_jet_control( |
| 2552 | 'message_success_bg_color', |
| 2553 | array( |
| 2554 | 'tab' => 'style', |
| 2555 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2556 | 'type' => 'color', |
| 2557 | 'css' => array( array( 'property' => '--jfb-message-success-bgc' ) ), |
| 2558 | ) |
| 2559 | ); |
| 2560 | |
| 2561 | $this->register_jet_control( |
| 2562 | 'message_success_border', |
| 2563 | array( |
| 2564 | 'tab' => 'style', |
| 2565 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2566 | 'type' => 'border', |
| 2567 | 'css' => array( |
| 2568 | array( |
| 2569 | 'property' => 'border', |
| 2570 | 'selector' => $css_selectors['success'], |
| 2571 | ), |
| 2572 | ), |
| 2573 | ) |
| 2574 | ); |
| 2575 | |
| 2576 | $this->register_jet_control( |
| 2577 | 'message_error_heading', |
| 2578 | array( |
| 2579 | 'tab' => 'style', |
| 2580 | 'type' => 'separator', |
| 2581 | 'label' => esc_html__( 'Error message', 'jet-form-builder' ), |
| 2582 | ) |
| 2583 | ); |
| 2584 | |
| 2585 | $this->register_jet_control( |
| 2586 | 'message_error_typography', |
| 2587 | array( |
| 2588 | 'tab' => 'style', |
| 2589 | 'label' => esc_html__( 'Typography', 'jet-form-builder' ), |
| 2590 | 'type' => 'typography', |
| 2591 | 'css' => array( |
| 2592 | array( |
| 2593 | 'property' => 'typography', |
| 2594 | 'selector' => $css_selectors['error'], |
| 2595 | ), |
| 2596 | ), |
| 2597 | ) |
| 2598 | ); |
| 2599 | |
| 2600 | $this->register_jet_control( |
| 2601 | 'message_error_bg_color', |
| 2602 | array( |
| 2603 | 'tab' => 'style', |
| 2604 | 'label' => esc_html__( 'Background color', 'jet-form-builder' ), |
| 2605 | 'type' => 'color', |
| 2606 | 'css' => array( array( 'property' => '--jfb-message-error-bgc' ) ), |
| 2607 | ) |
| 2608 | ); |
| 2609 | |
| 2610 | $this->register_jet_control( |
| 2611 | 'message_error_border', |
| 2612 | array( |
| 2613 | 'tab' => 'style', |
| 2614 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2615 | 'type' => 'border', |
| 2616 | 'css' => array( |
| 2617 | array( |
| 2618 | 'property' => 'border', |
| 2619 | 'selector' => $css_selectors['error'], |
| 2620 | ), |
| 2621 | ), |
| 2622 | ) |
| 2623 | ); |
| 2624 | |
| 2625 | $this->end_jet_control_group(); |
| 2626 | } |
| 2627 | // End message style |
| 2628 | |
| 2629 | |
| 2630 | /** |
| 2631 | * Enqueue element styles and scripts |
| 2632 | * |
| 2633 | * @noinspection PhpUnhandledExceptionInspection |
| 2634 | */ |
| 2635 | public function enqueue_scripts() { |
| 2636 | $module = jet_form_builder()->compat( 'bricks' ); |
| 2637 | |
| 2638 | wp_enqueue_style( |
| 2639 | $module->get_handle( 'frontend' ), |
| 2640 | $module->get_url( 'assets/build/frontend.css' ), |
| 2641 | array( 'jet-form-builder-frontend' ), |
| 2642 | Plugin::instance()->get_version() |
| 2643 | ); |
| 2644 | } |
| 2645 | |
| 2646 | /** |
| 2647 | * Render element HTML |
| 2648 | * |
| 2649 | * @noinspection PhpUnhandledExceptionInspection |
| 2650 | */ |
| 2651 | public function render() { |
| 2652 | |
| 2653 | $settings = $this->parse_jet_render_attributes( $this->get_jet_settings() ); |
| 2654 | |
| 2655 | // STEP: Form field is empty: Show placeholder text |
| 2656 | if ( empty( $settings['form_id'] ) && empty( $settings['form_id_custom'] ) ) { |
| 2657 | return $this->render_element_placeholder( |
| 2658 | array( |
| 2659 | 'title' => esc_html__( 'Please select form to show.', 'jet-form-builder' ), |
| 2660 | ) |
| 2661 | ); |
| 2662 | } |
| 2663 | |
| 2664 | $this->enqueue_scripts(); |
| 2665 | |
| 2666 | /** @var Blocks\Module $blocks */ |
| 2667 | $blocks = jet_form_builder()->module( \Jet_Form_Builder\Blocks\Module::class ); |
| 2668 | |
| 2669 | if ( ! empty( $settings['form_id_custom'] ) ) { |
| 2670 | $settings['form_id_custom'] = bricks_render_dynamic_data( $settings['form_id_custom'] ); |
| 2671 | } |
| 2672 | |
| 2673 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 2674 | echo "<div {$this->render_attributes( '_root' )}>"; |
| 2675 | $content = do_shortcode( $blocks->get_form_class()->render_callback_field( $settings ) ); |
| 2676 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 2677 | echo $content; |
| 2678 | echo '</div>'; |
| 2679 | } |
| 2680 | |
| 2681 | public function css_selector( $mod = null ) { |
| 2682 | return sprintf( '%1$s%2$s', '.jet-form-builder', $mod ); |
| 2683 | } |
| 2684 | } |
| 2685 |