form.php
3648 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Elementor\Widgets; |
| 5 | |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Border; |
| 8 | use Elementor\Group_Control_Box_Shadow; |
| 9 | use Elementor\Group_Control_Typography; |
| 10 | use Elementor\Widget_Base; |
| 11 | use Jet_Form_Builder\Blocks\Modules\General_Style_Functions; |
| 12 | use Jet_Form_Builder\Classes\Arguments\Form_Arguments; |
| 13 | use Jet_Form_Builder\Classes\Tools; |
| 14 | |
| 15 | // If this file is called directly, abort. |
| 16 | if ( ! defined( 'WPINC' ) ) { |
| 17 | die; |
| 18 | } |
| 19 | |
| 20 | class Form extends Widget_Base implements Widget_Base_It { |
| 21 | |
| 22 | use General_Style_Functions; |
| 23 | |
| 24 | public function init_hooks() { |
| 25 | add_filter( |
| 26 | 'jet-engine/booking-form/combine-selector', |
| 27 | array( $this, 'combine_selector' ), |
| 28 | 10, |
| 29 | 3 |
| 30 | ); |
| 31 | |
| 32 | add_filter( |
| 33 | 'jet-engine/forms/pre-render-form', |
| 34 | array( $this, 'booking_form_render' ), |
| 35 | 10, |
| 36 | 2 |
| 37 | ); |
| 38 | |
| 39 | add_action( |
| 40 | 'elementor/element/jet-engine-booking-form/section_general/after_section_start', |
| 41 | array( $this, 'after_general_section_start' ), |
| 42 | 10, |
| 43 | 2 |
| 44 | ); |
| 45 | |
| 46 | add_action( |
| 47 | 'elementor/element/jet-engine-booking-form/section_general/before_section_end', |
| 48 | array( $this, 'update_general_form_controls' ), |
| 49 | 10, |
| 50 | 2 |
| 51 | ); |
| 52 | |
| 53 | add_action( |
| 54 | 'elementor/element/jet-engine-booking-form/section_range_fields_style/before_section_end', |
| 55 | array( $this, 'update_section_range_fields_style' ), |
| 56 | 10, |
| 57 | 2 |
| 58 | ); |
| 59 | |
| 60 | add_action( |
| 61 | 'elementor/element/jet-engine-booking-form/form_submit_style/before_section_end', |
| 62 | array( $this, 'update_form_submit_style' ), |
| 63 | 10, |
| 64 | 2 |
| 65 | ); |
| 66 | |
| 67 | add_action( |
| 68 | 'elementor/element/jet-engine-booking-form/section_rows_style/before_section_end', |
| 69 | array( $this, 'update_section_rows_style' ), |
| 70 | 10, |
| 71 | 2 |
| 72 | ); |
| 73 | |
| 74 | add_action( |
| 75 | 'elementor/element/jet-engine-booking-form/section_fields_style/before_section_end', |
| 76 | array( $this, 'update_section_fields_style' ), |
| 77 | 10, |
| 78 | 2 |
| 79 | ); |
| 80 | |
| 81 | add_action( |
| 82 | 'elementor/element/jet-engine-booking-form/section_checkradio_fields_style/before_section_end', |
| 83 | array( $this, 'update_section_checkradio_fields_style' ), |
| 84 | 10, |
| 85 | 2 |
| 86 | ); |
| 87 | add_action( |
| 88 | 'elementor/element/jet-engine-booking-form/section_checkradio_fields_style/after_section_end', |
| 89 | array( $this, 'after_section_checkradio_fields_style' ), |
| 90 | 10, |
| 91 | 2 |
| 92 | ); |
| 93 | // form_prev_page_style |
| 94 | add_action( |
| 95 | 'elementor/element/jet-engine-booking-form/form_prev_page_style/after_section_end', |
| 96 | array( $this, 'after_form_prev_page_style' ), |
| 97 | 10, |
| 98 | 2 |
| 99 | ); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | /** |
| 104 | * @return string |
| 105 | */ |
| 106 | public function get_name() { |
| 107 | return 'jet-form-builder-form'; |
| 108 | } |
| 109 | |
| 110 | public function get_title() { |
| 111 | return __( 'JetForm', 'jet-form-builder' ); |
| 112 | } |
| 113 | |
| 114 | public function get_icon() { |
| 115 | return 'jet-form-builder-icon--form'; |
| 116 | } |
| 117 | |
| 118 | public function get_categories() { |
| 119 | return array( 'jet-form-builder' ); |
| 120 | } |
| 121 | |
| 122 | public function get_style_depends() { |
| 123 | return array( 'jet-form-builder-frontend' ); |
| 124 | } |
| 125 | |
| 126 | private function jet_form_builder_slug() { |
| 127 | return jet_form_builder()->post_type->slug(); |
| 128 | } |
| 129 | |
| 130 | private function jet_engine_form_slug() { |
| 131 | return jet_engine()->forms->slug(); |
| 132 | } |
| 133 | |
| 134 | public function combine_selector( $additional, $engine_selector, $control_id ) { |
| 135 | if ( ! $control_id ) { |
| 136 | return $this->selector( $engine_selector ); |
| 137 | } |
| 138 | |
| 139 | switch ( $control_id ) { |
| 140 | case 'labels_v_alignment': |
| 141 | return $this->selector( '-row' ); |
| 142 | case 'fields_background_color': |
| 143 | return $this->selector( '__field:not(.checkradio-field):not(.range-field):not(.%s-repeater)' ); |
| 144 | case 'field_messages_font_size': |
| 145 | case 'field_messages_color': |
| 146 | case 'field_messages_margin': |
| 147 | case 'field_messages_alignment': |
| 148 | return $this->selector( '-file-upload__errors' ); |
| 149 | } |
| 150 | |
| 151 | return ''; |
| 152 | } |
| 153 | |
| 154 | |
| 155 | public function after_general_section_start( $element, $args ) { |
| 156 | $element->add_control( |
| 157 | 'form_provider', |
| 158 | array( |
| 159 | 'label' => __( 'Choose Provider', 'jet-form-builder' ), |
| 160 | 'type' => Controls_Manager::SELECT, |
| 161 | 'options' => array( |
| 162 | $this->jet_form_builder_slug() => __( 'JetFormBuilder', 'jet-form-builder' ), |
| 163 | $this->jet_engine_form_slug() => __( 'JetEngine', 'jet-form-builder' ), |
| 164 | ), |
| 165 | 'default' => $this->jet_engine_form_slug(), |
| 166 | ) |
| 167 | ); |
| 168 | |
| 169 | $element->add_control( |
| 170 | 'form_id', |
| 171 | array( |
| 172 | 'label' => __( 'Select JetForm', 'jet-form-builder' ), |
| 173 | 'type' => 'jet-query', |
| 174 | 'query_type' => 'post', |
| 175 | 'query' => array( |
| 176 | 'post_type' => $this->jet_form_builder_slug(), |
| 177 | ), |
| 178 | 'condition' => array( 'form_provider' => $this->jet_form_builder_slug() ), |
| 179 | ) |
| 180 | ); |
| 181 | } |
| 182 | |
| 183 | public function update_general_form_controls( $element, $args ) { |
| 184 | $element->update_control( |
| 185 | '_form_id', |
| 186 | array( |
| 187 | 'condition' => array( 'form_provider' => $this->jet_engine_form_slug() ), |
| 188 | ) |
| 189 | ); |
| 190 | $element->update_control( |
| 191 | 'fields_label_tag', |
| 192 | array( |
| 193 | 'condition' => array( 'form_provider' => $this->jet_engine_form_slug() ), |
| 194 | ) |
| 195 | ); |
| 196 | $element->update_control( |
| 197 | 'cache_form', |
| 198 | array( |
| 199 | 'condition' => array( 'form_provider' => $this->jet_engine_form_slug() ), |
| 200 | ) |
| 201 | ); |
| 202 | $element->add_control( |
| 203 | 'enable_progress', |
| 204 | array( |
| 205 | 'label' => __( 'Enable form pages progress', 'jet-form-builder' ), |
| 206 | 'type' => Controls_Manager::SWITCHER, |
| 207 | 'condition' => array( 'form_provider' => $this->jet_form_builder_slug() ), |
| 208 | ) |
| 209 | ); |
| 210 | } |
| 211 | |
| 212 | public function update_section_rows_style( $element, $args ) { |
| 213 | $element->update_control( |
| 214 | 'rows_divider', |
| 215 | array( |
| 216 | 'condition' => array( 'form_provider' => $this->jet_engine_form_slug() ), |
| 217 | ) |
| 218 | ); |
| 219 | $element->update_control( |
| 220 | 'rows_divider_height', |
| 221 | array( |
| 222 | 'condition' => array( 'form_provider' => $this->jet_engine_form_slug() ), |
| 223 | ), |
| 224 | array( 'recursive' => true ) |
| 225 | ); |
| 226 | $element->update_control( |
| 227 | 'rows_divider_color', |
| 228 | array( |
| 229 | 'condition' => array( 'form_provider' => $this->jet_engine_form_slug() ), |
| 230 | ), |
| 231 | array( 'recursive' => true ) |
| 232 | ); |
| 233 | $element->update_control( |
| 234 | 'cols_gap', |
| 235 | array( |
| 236 | 'selectors' => array( |
| 237 | $this->selector( ' .wp-block-column:not(:first-child)' ) => 'margin-left: {{SIZE}}{{UNIT}};', |
| 238 | ), |
| 239 | ), |
| 240 | array( 'recursive' => true ) |
| 241 | ); |
| 242 | } |
| 243 | |
| 244 | public function update_section_fields_style( $element, $args ) { |
| 245 | $element->update_control( |
| 246 | 'fields_placeholder_color', |
| 247 | array( |
| 248 | 'selectors' => array( |
| 249 | $this->selector( ' ::-webkit-input-placeholder' ) => 'color: {{VALUE}};', |
| 250 | $this->selector( ' ::-ms-input-placeholder' ) => 'color: {{VALUE}};', |
| 251 | $this->selector( ' ::-moz-placeholder' ) => 'color: {{VALUE}};', |
| 252 | $this->selector( ' :-moz-placeholder' ) => 'color: {{VALUE}};', |
| 253 | ), |
| 254 | ), |
| 255 | array( 'recursive' => true ) |
| 256 | ); |
| 257 | } |
| 258 | |
| 259 | public function update_section_checkradio_fields_style( $element, $args ) { |
| 260 | $element->update_control( |
| 261 | 'checkradio_fields_gap', |
| 262 | array( |
| 263 | 'selectors' => array( |
| 264 | 'body:not(.rtl) ' . $this->selector( '__field-wrap.checkradio-wrap span::before' ) => 'margin-right: {{SIZE}}px;', |
| 265 | 'body.rtl ' . $this->selector( '__field-wrap.checkradio-wrap span::before' ) => 'margin-left: {{SIZE}}px;', |
| 266 | ), |
| 267 | ), |
| 268 | array( 'recursive' => true ) |
| 269 | ); |
| 270 | } |
| 271 | |
| 272 | public function after_section_checkradio_fields_style( $booking_form, $args ) { |
| 273 | $booking_form->start_controls_section( |
| 274 | 'builder__checkbox_field_style_section', |
| 275 | $this->on_fb( |
| 276 | array( |
| 277 | 'label' => __( 'JetForm Checkbox', 'jet-form-builder' ), |
| 278 | 'tab' => Controls_Manager::TAB_STYLE, |
| 279 | ) |
| 280 | ) |
| 281 | ); |
| 282 | |
| 283 | $booking_form->add_control( |
| 284 | 'builder__checkbox_show_decorator', |
| 285 | array( |
| 286 | 'label' => __( 'Show Checkbox', 'jet-form-builder' ), |
| 287 | 'type' => Controls_Manager::CHOOSE, |
| 288 | 'options' => array( |
| 289 | 'inline-block' => array( |
| 290 | 'title' => __( 'Yes', 'jet-form-builder' ), |
| 291 | 'icon' => 'fa fa-check', |
| 292 | ), |
| 293 | 'none' => array( |
| 294 | 'title' => __( 'No', 'jet-form-builder' ), |
| 295 | 'icon' => 'fa fa-times', |
| 296 | ), |
| 297 | ), |
| 298 | 'default' => 'inline-block', |
| 299 | 'selectors' => array( |
| 300 | $this->selector( '__field-wrap .for-checkbox span::before' ) => 'display:{{VALUE}};', |
| 301 | ), |
| 302 | ) |
| 303 | ); |
| 304 | |
| 305 | $booking_form->add_responsive_control( |
| 306 | 'builder__checkbox_size', |
| 307 | array( |
| 308 | 'label' => __( 'Checkbox Size', 'jet-form-builder' ), |
| 309 | 'type' => Controls_Manager::SLIDER, |
| 310 | 'size_units' => array( 'px' ), |
| 311 | 'range' => array( |
| 312 | 'px' => array( |
| 313 | 'min' => 0, |
| 314 | 'max' => 50, |
| 315 | ), |
| 316 | ), |
| 317 | 'selectors' => array( |
| 318 | $this->selector( '__field-wrap .for-checkbox span::before' ) => 'font-size: {{SIZE}}px;', |
| 319 | ), |
| 320 | 'condition' => array( |
| 321 | 'builder__checkbox_show_decorator' => 'inline-block', |
| 322 | ), |
| 323 | ) |
| 324 | ); |
| 325 | |
| 326 | $booking_form->start_controls_tabs( 'builder__checkbox_state_styles' ); |
| 327 | |
| 328 | $booking_form->start_controls_tab( |
| 329 | 'builder__checkbox_state--normal', |
| 330 | array( |
| 331 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 332 | ) |
| 333 | ); |
| 334 | $this->add_border( |
| 335 | $booking_form, |
| 336 | 'builder__checkbox_state--normal__border', |
| 337 | $this->selector( '__field-wrap .for-checkbox span::before' ) |
| 338 | ); |
| 339 | |
| 340 | $booking_form->add_control( |
| 341 | 'builder__checkbox_state--normal__bg_color', |
| 342 | array( |
| 343 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 344 | 'type' => Controls_Manager::COLOR, |
| 345 | 'selectors' => array( |
| 346 | $this->selector( '__field-wrap .for-checkbox span::before' ) => 'background-color: {{VALUE}}', |
| 347 | ), |
| 348 | ) |
| 349 | ); |
| 350 | |
| 351 | $booking_form->end_controls_tab(); |
| 352 | |
| 353 | $booking_form->start_controls_tab( |
| 354 | 'builder__checkbox_state--checked', |
| 355 | array( |
| 356 | 'label' => esc_html__( 'Checked', 'jet-form-builder' ), |
| 357 | ) |
| 358 | ); |
| 359 | |
| 360 | $this->add_border( |
| 361 | $booking_form, |
| 362 | 'builder__checkbox_state--checked__border', |
| 363 | $this->selector( '__field-wrap label.for-checkbox :checked + span::before' ) |
| 364 | ); |
| 365 | $booking_form->add_control( |
| 366 | 'builder__checkbox_state--checked__bg_color', |
| 367 | array( |
| 368 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 369 | 'type' => Controls_Manager::COLOR, |
| 370 | 'selectors' => array( |
| 371 | $this->selector( '__field-wrap label.for-checkbox :checked + span::before' ) => 'background-color: {{VALUE}}', |
| 372 | ), |
| 373 | ) |
| 374 | ); |
| 375 | |
| 376 | $booking_form->end_controls_tab(); |
| 377 | $booking_form->end_controls_tabs(); |
| 378 | $booking_form->end_controls_section(); |
| 379 | |
| 380 | $booking_form->start_controls_section( |
| 381 | 'builder__radio_field_style_section', |
| 382 | $this->on_fb( |
| 383 | array( |
| 384 | 'label' => __( 'JetForm Radio', 'jet-form-builder' ), |
| 385 | 'tab' => Controls_Manager::TAB_STYLE, |
| 386 | ) |
| 387 | ) |
| 388 | ); |
| 389 | $booking_form->add_control( |
| 390 | 'builder__radio_show_decorator', |
| 391 | array( |
| 392 | 'label' => __( 'Show Radio', 'jet-form-builder' ), |
| 393 | 'type' => Controls_Manager::CHOOSE, |
| 394 | 'default' => 'inline-block', |
| 395 | 'options' => array( |
| 396 | 'inline-block' => array( |
| 397 | 'title' => __( 'Yes', 'jet-form-builder' ), |
| 398 | 'icon' => 'fa fa-check', |
| 399 | ), |
| 400 | 'none' => array( |
| 401 | 'title' => __( 'No', 'jet-form-builder' ), |
| 402 | 'icon' => 'fa fa-times', |
| 403 | ), |
| 404 | ), |
| 405 | 'selectors' => array( |
| 406 | $this->selector( '__field-wrap .for-radio span::before' ) => 'display:{{VALUE}};', |
| 407 | ), |
| 408 | ) |
| 409 | ); |
| 410 | |
| 411 | $booking_form->add_responsive_control( |
| 412 | 'builder__radio_size', |
| 413 | array( |
| 414 | 'label' => __( 'Radio Size', 'jet-form-builder' ), |
| 415 | 'type' => Controls_Manager::SLIDER, |
| 416 | 'size_units' => array( 'px' ), |
| 417 | 'range' => array( |
| 418 | 'px' => array( |
| 419 | 'min' => 0, |
| 420 | 'max' => 50, |
| 421 | ), |
| 422 | ), |
| 423 | 'selectors' => array( |
| 424 | $this->selector( '__field-wrap .for-radio span::before' ) => 'font-size: {{SIZE}}px;', |
| 425 | ), |
| 426 | 'condition' => array( |
| 427 | 'builder__radio_show_decorator' => 'inline-block', |
| 428 | ), |
| 429 | ) |
| 430 | ); |
| 431 | |
| 432 | $booking_form->start_controls_tabs( 'builder__radio_state_styles' ); |
| 433 | |
| 434 | $booking_form->start_controls_tab( |
| 435 | 'builder__radio_state--normal', |
| 436 | array( |
| 437 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 438 | ) |
| 439 | ); |
| 440 | $this->add_border( |
| 441 | $booking_form, |
| 442 | 'builder__radio_state--normal__border', |
| 443 | $this->selector( '__field-wrap .for-radio span::before' ) |
| 444 | ); |
| 445 | $booking_form->add_control( |
| 446 | 'builder__radio_state--normal__bg_color', |
| 447 | array( |
| 448 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 449 | 'type' => Controls_Manager::COLOR, |
| 450 | 'selectors' => array( |
| 451 | $this->selector( '__field-wrap .for-radio span::before' ) => 'background-color: {{VALUE}}', |
| 452 | ), |
| 453 | ) |
| 454 | ); |
| 455 | |
| 456 | $booking_form->end_controls_tab(); |
| 457 | |
| 458 | $booking_form->start_controls_tab( |
| 459 | 'builder__radio_state--checked', |
| 460 | array( |
| 461 | 'label' => esc_html__( 'Checked', 'jet-form-builder' ), |
| 462 | ) |
| 463 | ); |
| 464 | $this->add_border( |
| 465 | $booking_form, |
| 466 | 'builder__radio_state--checked__border', |
| 467 | $this->selector( '__field-wrap label.for-radio :checked + span::before' ) |
| 468 | ); |
| 469 | $booking_form->add_control( |
| 470 | 'builder__radio_state--checked__bg_color', |
| 471 | array( |
| 472 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 473 | 'type' => Controls_Manager::COLOR, |
| 474 | 'selectors' => array( |
| 475 | $this->selector( '__field-wrap label.for-radio :checked + span::before' ) => 'background-color: {{VALUE}}', |
| 476 | ), |
| 477 | ) |
| 478 | ); |
| 479 | |
| 480 | $booking_form->end_controls_tab(); |
| 481 | $booking_form->end_controls_tabs(); |
| 482 | $booking_form->end_controls_section(); |
| 483 | } |
| 484 | |
| 485 | public function after_form_prev_page_style( $element, $args ) { |
| 486 | $this->run_form_progress_controls( |
| 487 | $element, |
| 488 | array( $this, 'selector' ), |
| 489 | array( $this, 'on_fb' ) |
| 490 | ); |
| 491 | } |
| 492 | |
| 493 | public function update_section_range_fields_style( $element, $args ) { |
| 494 | $range_obj = jet_form_builder()->blocks->get_field_by_name( 'range-field' ); |
| 495 | |
| 496 | $element->update_control( |
| 497 | 'track_height', |
| 498 | array( |
| 499 | 'selectors' => array( |
| 500 | $this->selector() => $range_obj::CSS_VAR_RANGE_HEIGHT . ': {{SIZE}}{{UNIT}};', |
| 501 | ), |
| 502 | ), |
| 503 | array( 'recursive' => true ) |
| 504 | ); |
| 505 | $element->update_control( |
| 506 | 'thumb_size', |
| 507 | array( |
| 508 | 'selectors' => array( |
| 509 | $this->selector() => $range_obj::CSS_VAR_SLIDER_SIZE . ': {{SIZE}}{{UNIT}};', |
| 510 | ), |
| 511 | ), |
| 512 | array( 'recursive' => true ) |
| 513 | ); |
| 514 | |
| 515 | $element->update_control( |
| 516 | 'track_border_radius', |
| 517 | array( |
| 518 | 'selectors' => array( |
| 519 | $this->selector( '__field.range-field::-webkit-slider-runnable-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 520 | $this->selector( '__field.range-field::-moz-range-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 521 | $this->selector( '__field.range-field::-ms-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 522 | ), |
| 523 | ), |
| 524 | array( 'recursive' => true ) |
| 525 | ); |
| 526 | $element->update_control( |
| 527 | 'thumb_border_radius', |
| 528 | array( |
| 529 | 'selectors' => array( |
| 530 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 531 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 532 | $this->selector( '__field.range-field::-ms-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 533 | ), |
| 534 | ), |
| 535 | array( 'recursive' => true ) |
| 536 | ); |
| 537 | |
| 538 | $element->update_control( |
| 539 | 'track_bg_color', |
| 540 | array( |
| 541 | 'selectors' => array( |
| 542 | $this->selector( '__field.range-field::-webkit-slider-runnable-track' ) => 'background-color: {{VALUE}};', |
| 543 | $this->selector( '__field.range-field::-moz-range-track' ) => 'background-color: {{VALUE}};', |
| 544 | $this->selector( '__field.range-field::-ms-track' ) => 'background-color: {{VALUE}};', |
| 545 | ), |
| 546 | ), |
| 547 | array( 'recursive' => true ) |
| 548 | ); |
| 549 | $element->update_control( |
| 550 | 'thumb_bg_color', |
| 551 | array( |
| 552 | 'selectors' => array( |
| 553 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'background-color: {{VALUE}};', |
| 554 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'background-color: {{VALUE}};', |
| 555 | $this->selector( '__field.range-field::-ms-thumb' ) => 'background-color: {{VALUE}};', |
| 556 | ), |
| 557 | ), |
| 558 | array( 'recursive' => true ) |
| 559 | ); |
| 560 | } |
| 561 | |
| 562 | public function update_form_submit_style( $element, $args ) { |
| 563 | $element->update_control( |
| 564 | 'booking_form_submit_alignment', |
| 565 | array( |
| 566 | 'selectors' => array( |
| 567 | $this->selector( '__submit' ) => 'justify-content: center;', |
| 568 | ), |
| 569 | ), |
| 570 | array( 'recursive' => true ) |
| 571 | ); |
| 572 | } |
| 573 | |
| 574 | |
| 575 | private function on_fb( $args ) { |
| 576 | return array_merge( |
| 577 | $args, |
| 578 | array( |
| 579 | 'condition' => array( |
| 580 | 'form_provider' => jet_form_builder()->post_type->slug(), |
| 581 | ), |
| 582 | ) |
| 583 | ); |
| 584 | } |
| 585 | |
| 586 | public function on_jet_engine( $args ) { |
| 587 | return array_merge_recursive( |
| 588 | $args, |
| 589 | array( |
| 590 | 'condition' => array( |
| 591 | 'form_provider' => jet_engine()->forms->slug(), |
| 592 | ), |
| 593 | ) |
| 594 | ); |
| 595 | } |
| 596 | |
| 597 | |
| 598 | public function run_form_progress_controls( $instance, $selector_callable, $add_section_condition ) { |
| 599 | $instance->start_controls_section( |
| 600 | 'jet_fb_progress_wrapper_section', |
| 601 | $add_section_condition( |
| 602 | array( |
| 603 | 'label' => __( 'Form Progress - Wrapper', 'jet-form-builder' ), |
| 604 | 'tab' => Controls_Manager::TAB_STYLE, |
| 605 | ) |
| 606 | ) |
| 607 | ); |
| 608 | $instance->add_responsive_control( |
| 609 | 'jet_fb_progress_wrapper_margin', |
| 610 | array( |
| 611 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 612 | 'type' => Controls_Manager::DIMENSIONS, |
| 613 | 'size_units' => array( 'px' ), |
| 614 | 'selectors' => array( |
| 615 | $selector_callable( '-progress-pages' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 616 | ), |
| 617 | ) |
| 618 | ); |
| 619 | $instance->add_responsive_control( |
| 620 | 'jet_fb_progress_wrapper_padding', |
| 621 | array( |
| 622 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 623 | 'type' => Controls_Manager::DIMENSIONS, |
| 624 | 'size_units' => array( 'px' ), |
| 625 | 'selectors' => array( |
| 626 | $selector_callable( '-progress-pages' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 627 | ), |
| 628 | ) |
| 629 | ); |
| 630 | $instance->add_group_control( |
| 631 | Group_Control_Typography::get_type(), |
| 632 | array( |
| 633 | 'name' => 'jet_fb_progress_wrapper_typography', |
| 634 | 'selector' => $selector_callable( '-progress-pages' ), |
| 635 | ) |
| 636 | ); |
| 637 | $this->add_border( |
| 638 | $instance, |
| 639 | 'jet_fb_progress_wrapper_border', |
| 640 | $selector_callable( '-progress-pages' ) |
| 641 | ); |
| 642 | $instance->add_control( |
| 643 | 'jet_fb_progress_wrapper_color', |
| 644 | array( |
| 645 | 'label' => __( 'Text Color', 'jet-form-builder' ), |
| 646 | 'type' => Controls_Manager::COLOR, |
| 647 | 'selectors' => array( |
| 648 | $selector_callable( '-progress-pages' ) => 'color: {{VALUE}}', |
| 649 | ), |
| 650 | ) |
| 651 | ); |
| 652 | $instance->add_control( |
| 653 | 'jet_fb_progress_wrapper_bg_color', |
| 654 | array( |
| 655 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 656 | 'type' => Controls_Manager::COLOR, |
| 657 | 'selectors' => array( |
| 658 | $selector_callable( '-progress-pages' ) => 'background-color: {{VALUE}}', |
| 659 | ), |
| 660 | ) |
| 661 | ); |
| 662 | $instance->end_controls_section(); |
| 663 | |
| 664 | $instance->start_controls_section( |
| 665 | 'jet_fb_progress_pages_section', |
| 666 | $add_section_condition( |
| 667 | array( |
| 668 | 'label' => __( 'Form Progress - Pages', 'jet-form-builder' ), |
| 669 | 'tab' => Controls_Manager::TAB_STYLE, |
| 670 | ) |
| 671 | ) |
| 672 | ); |
| 673 | $instance->start_controls_tabs( 'jet_fb_progress_pages_tabs' ); |
| 674 | |
| 675 | $wrapper = '-progress-pages__item--wrapper'; |
| 676 | $item = '-progress-pages__item'; |
| 677 | |
| 678 | $scheme = array( |
| 679 | 'active-wrapper' => "$wrapper.active-page", |
| 680 | 'active-item' => "$wrapper.active-page .%s$item", |
| 681 | 'active-separator' => "$wrapper.active-page .%s-progress-pages__separator", |
| 682 | 'active-circle' => "$wrapper.active-page .%s$item--circle", |
| 683 | |
| 684 | 'next-wrapper' => "$wrapper:not(.passed-page):not(.active-page)", |
| 685 | 'next-item' => "$wrapper:not(.passed-page):not(.active-page) .%s$item", |
| 686 | 'next-separator' => "$wrapper:not(.passed-page):not(.active-page) .%s-progress-pages__separator", |
| 687 | 'next-circle' => "$wrapper:not(.passed-page):not(.active-page) .%s$item--circle", |
| 688 | |
| 689 | 'prev-wrapper' => "$wrapper.passed-page", |
| 690 | 'prev-item' => "$wrapper.passed-page .%s$item", |
| 691 | 'prev-separator' => "$wrapper.passed-page .%s-progress-pages__separator", |
| 692 | 'prev-circle' => "$wrapper.passed-page .%s$item--circle", |
| 693 | ); |
| 694 | |
| 695 | $instance->start_controls_tab( |
| 696 | 'jet_fb_progress_pages_tab--current', |
| 697 | array( |
| 698 | 'label' => esc_html__( 'Current', 'jet-form-builder' ), |
| 699 | ) |
| 700 | ); |
| 701 | $instance->add_responsive_control( |
| 702 | 'jet_fb_progress_pages_tab--current_padding', |
| 703 | array( |
| 704 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 705 | 'type' => Controls_Manager::DIMENSIONS, |
| 706 | 'size_units' => array( 'px' ), |
| 707 | 'selectors' => array( |
| 708 | $selector_callable( $scheme['active-item'] ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 709 | ), |
| 710 | ) |
| 711 | ); |
| 712 | $instance->add_responsive_control( |
| 713 | 'jet_fb_progress_pages_tab--current_margin', |
| 714 | array( |
| 715 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 716 | 'type' => Controls_Manager::DIMENSIONS, |
| 717 | 'size_units' => array( 'px' ), |
| 718 | 'selectors' => array( |
| 719 | $selector_callable( $scheme['active-item'] ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 720 | ), |
| 721 | ) |
| 722 | ); |
| 723 | $instance->add_group_control( |
| 724 | Group_Control_Typography::get_type(), |
| 725 | array( |
| 726 | 'name' => 'jet_fb_progress_pages_tab--current_typography', |
| 727 | 'selector' => $selector_callable( $scheme['active-item'] ), |
| 728 | ) |
| 729 | ); |
| 730 | $this->add_border( |
| 731 | $instance, |
| 732 | 'jet_fb_progress_pages_tab--current_item_border', |
| 733 | $selector_callable( $scheme['active-item'] ) |
| 734 | ); |
| 735 | $instance->add_control( |
| 736 | 'jet_fb_progress_pages_tab--current_color', |
| 737 | array( |
| 738 | 'label' => __( 'Text Color', 'jet-form-builder' ), |
| 739 | 'type' => Controls_Manager::COLOR, |
| 740 | 'selectors' => array( |
| 741 | $selector_callable( $scheme['active-item'] ) => 'color: {{VALUE}}', |
| 742 | ), |
| 743 | ) |
| 744 | ); |
| 745 | $instance->add_control( |
| 746 | 'jet_fb_progress_pages_tab--current_bg_color', |
| 747 | array( |
| 748 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 749 | 'type' => Controls_Manager::COLOR, |
| 750 | 'selectors' => array( |
| 751 | $selector_callable( $scheme['active-item'] ) => 'background-color: {{VALUE}}', |
| 752 | ), |
| 753 | ) |
| 754 | ); |
| 755 | $instance->add_control( |
| 756 | 'jet_fb_separator_active_separator', |
| 757 | array( |
| 758 | 'label' => esc_html__( 'Separator', 'jet-form-builder' ), |
| 759 | 'type' => Controls_Manager::HEADING, |
| 760 | 'separator' => 'before', |
| 761 | ) |
| 762 | ); |
| 763 | $instance->add_responsive_control( |
| 764 | 'jet_fb_progress_pages_tab--current_separator_height', |
| 765 | array( |
| 766 | 'label' => __( 'Height', 'jet-form-builder' ), |
| 767 | 'type' => Controls_Manager::SLIDER, |
| 768 | 'size_units' => array( 'px' ), |
| 769 | 'range' => array( |
| 770 | 'px' => array( |
| 771 | 'min' => 1, |
| 772 | 'max' => 100, |
| 773 | ), |
| 774 | ), |
| 775 | 'selectors' => array( |
| 776 | $selector_callable( $scheme['active-separator'] ) => 'height: {{SIZE}}px; min-height: {{SIZE}}px;', |
| 777 | ), |
| 778 | ) |
| 779 | ); |
| 780 | $instance->add_control( |
| 781 | 'jet_fb_progress_pages_tab--current_separator_color', |
| 782 | array( |
| 783 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 784 | 'type' => Controls_Manager::COLOR, |
| 785 | 'selectors' => array( |
| 786 | $selector_callable( $scheme['active-separator'] ) => 'background-color: {{VALUE}}', |
| 787 | ), |
| 788 | ) |
| 789 | ); |
| 790 | $instance->add_control( |
| 791 | 'jet_fb_separator_active_circle', |
| 792 | array( |
| 793 | 'label' => esc_html__( 'Circle', 'jet-form-builder' ), |
| 794 | 'type' => Controls_Manager::HEADING, |
| 795 | 'separator' => 'before', |
| 796 | ) |
| 797 | ); |
| 798 | $this->add_border( |
| 799 | $instance, |
| 800 | 'jet_fb_progress_pages_tab--current_separator_border', |
| 801 | $selector_callable( $scheme['active-circle'] ) |
| 802 | ); |
| 803 | $instance->end_controls_tab(); |
| 804 | |
| 805 | $instance->start_controls_tab( |
| 806 | 'jet_fb_progress_pages_tab--next', |
| 807 | array( |
| 808 | 'label' => esc_html__( 'Next', 'jet-form-builder' ), |
| 809 | ) |
| 810 | ); |
| 811 | $instance->add_responsive_control( |
| 812 | 'jet_fb_progress_pages_tab--next_padding', |
| 813 | array( |
| 814 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 815 | 'type' => Controls_Manager::DIMENSIONS, |
| 816 | 'size_units' => array( 'px' ), |
| 817 | 'selectors' => array( |
| 818 | $selector_callable( $scheme['next-item'] ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 819 | ), |
| 820 | ) |
| 821 | ); |
| 822 | $instance->add_responsive_control( |
| 823 | 'jet_fb_progress_pages_tab--next_margin', |
| 824 | array( |
| 825 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 826 | 'type' => Controls_Manager::DIMENSIONS, |
| 827 | 'size_units' => array( 'px' ), |
| 828 | 'selectors' => array( |
| 829 | $selector_callable( $scheme['next-item'] ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 830 | ), |
| 831 | ) |
| 832 | ); |
| 833 | $instance->add_group_control( |
| 834 | Group_Control_Typography::get_type(), |
| 835 | array( |
| 836 | 'name' => 'jet_fb_progress_pages_tab--next_typography', |
| 837 | 'selector' => $selector_callable( $scheme['next-item'] ), |
| 838 | ) |
| 839 | ); |
| 840 | $this->add_border( |
| 841 | $instance, |
| 842 | 'jet_fb_progress_pages_tab--next_item_border', |
| 843 | $selector_callable( $scheme['next-item'] ) |
| 844 | ); |
| 845 | $instance->add_control( |
| 846 | 'jet_fb_progress_pages_tab--next_color', |
| 847 | array( |
| 848 | 'label' => __( 'Text Color', 'jet-form-builder' ), |
| 849 | 'type' => Controls_Manager::COLOR, |
| 850 | 'selectors' => array( |
| 851 | $selector_callable( $scheme['next-item'] ) => 'color: {{VALUE}}', |
| 852 | ), |
| 853 | ) |
| 854 | ); |
| 855 | $instance->add_control( |
| 856 | 'jet_fb_progress_pages_tab--next_bg_color', |
| 857 | array( |
| 858 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 859 | 'type' => Controls_Manager::COLOR, |
| 860 | 'selectors' => array( |
| 861 | $selector_callable( $scheme['next-item'] ) => 'background-color: {{VALUE}}', |
| 862 | ), |
| 863 | ) |
| 864 | ); |
| 865 | $instance->add_control( |
| 866 | 'jet_fb_separator_next_separator', |
| 867 | array( |
| 868 | 'label' => esc_html__( 'Separator', 'jet-form-builder' ), |
| 869 | 'type' => Controls_Manager::HEADING, |
| 870 | 'separator' => 'before', |
| 871 | ) |
| 872 | ); |
| 873 | $instance->add_responsive_control( |
| 874 | 'jet_fb_progress_pages_tab--next_separator_height', |
| 875 | array( |
| 876 | 'label' => __( 'Height', 'jet-form-builder' ), |
| 877 | 'type' => Controls_Manager::SLIDER, |
| 878 | 'size_units' => array( 'px' ), |
| 879 | 'range' => array( |
| 880 | 'px' => array( |
| 881 | 'min' => 1, |
| 882 | 'max' => 100, |
| 883 | ), |
| 884 | ), |
| 885 | 'selectors' => array( |
| 886 | $selector_callable( $scheme['next-separator'] ) => 'height: {{SIZE}}px; min-height: {{SIZE}}px;', |
| 887 | ), |
| 888 | ) |
| 889 | ); |
| 890 | $instance->add_control( |
| 891 | 'jet_fb_progress_pages_tab--next_separator_color', |
| 892 | array( |
| 893 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 894 | 'type' => Controls_Manager::COLOR, |
| 895 | 'selectors' => array( |
| 896 | $selector_callable( $scheme['next-separator'] ) => 'background-color: {{VALUE}}', |
| 897 | ), |
| 898 | ) |
| 899 | ); |
| 900 | $instance->add_control( |
| 901 | 'jet_fb_separator_next_circle', |
| 902 | array( |
| 903 | 'label' => esc_html__( 'Circle', 'jet-form-builder' ), |
| 904 | 'type' => Controls_Manager::HEADING, |
| 905 | 'separator' => 'before', |
| 906 | ) |
| 907 | ); |
| 908 | $this->add_border( |
| 909 | $instance, |
| 910 | 'jet_fb_progress_pages_tab--next_separator_border', |
| 911 | $selector_callable( $scheme['next-circle'] ) |
| 912 | ); |
| 913 | $instance->end_controls_tab(); |
| 914 | |
| 915 | $instance->start_controls_tab( |
| 916 | 'jet_fb_progress_pages_tab--prev', |
| 917 | array( |
| 918 | 'label' => esc_html__( 'Prev', 'jet-form-builder' ), |
| 919 | ) |
| 920 | ); |
| 921 | $instance->add_responsive_control( |
| 922 | 'jet_fb_progress_pages_tab--prev_padding', |
| 923 | array( |
| 924 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 925 | 'type' => Controls_Manager::DIMENSIONS, |
| 926 | 'size_units' => array( 'px' ), |
| 927 | 'selectors' => array( |
| 928 | $selector_callable( $scheme['prev-item'] ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 929 | ), |
| 930 | ) |
| 931 | ); |
| 932 | $instance->add_responsive_control( |
| 933 | 'jet_fb_progress_pages_tab--prev_margin', |
| 934 | array( |
| 935 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 936 | 'type' => Controls_Manager::DIMENSIONS, |
| 937 | 'size_units' => array( 'px' ), |
| 938 | 'selectors' => array( |
| 939 | $selector_callable( $scheme['prev-item'] ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 940 | ), |
| 941 | ) |
| 942 | ); |
| 943 | $instance->add_group_control( |
| 944 | Group_Control_Typography::get_type(), |
| 945 | array( |
| 946 | 'name' => 'jet_fb_progress_pages_tab--prev_typography', |
| 947 | 'selector' => $selector_callable( $scheme['prev-item'] ), |
| 948 | ) |
| 949 | ); |
| 950 | $this->add_border( |
| 951 | $instance, |
| 952 | 'jet_fb_progress_pages_tab--prev_item_border', |
| 953 | $selector_callable( $scheme['prev-item'] ) |
| 954 | ); |
| 955 | $instance->add_control( |
| 956 | 'jet_fb_progress_pages_tab--prev_color', |
| 957 | array( |
| 958 | 'label' => __( 'Text Color', 'jet-form-builder' ), |
| 959 | 'type' => Controls_Manager::COLOR, |
| 960 | 'selectors' => array( |
| 961 | $selector_callable( $scheme['prev-item'] ) => 'color: {{VALUE}}', |
| 962 | ), |
| 963 | ) |
| 964 | ); |
| 965 | $instance->add_control( |
| 966 | 'jet_fb_progress_pages_tab--prev_bg_color', |
| 967 | array( |
| 968 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 969 | 'type' => Controls_Manager::COLOR, |
| 970 | 'selectors' => array( |
| 971 | $selector_callable( $scheme['prev-item'] ) => 'background-color: {{VALUE}}', |
| 972 | ), |
| 973 | ) |
| 974 | ); |
| 975 | $instance->add_control( |
| 976 | 'jet_fb_separator_prev_separator', |
| 977 | array( |
| 978 | 'label' => esc_html__( 'Separator', 'jet-form-builder' ), |
| 979 | 'type' => Controls_Manager::HEADING, |
| 980 | 'separator' => 'before', |
| 981 | ) |
| 982 | ); |
| 983 | $instance->add_responsive_control( |
| 984 | 'jet_fb_progress_pages_tab--prev_separator_height', |
| 985 | array( |
| 986 | 'label' => __( 'Height', 'jet-form-builder' ), |
| 987 | 'type' => Controls_Manager::SLIDER, |
| 988 | 'size_units' => array( 'px' ), |
| 989 | 'range' => array( |
| 990 | 'px' => array( |
| 991 | 'min' => 1, |
| 992 | 'max' => 100, |
| 993 | ), |
| 994 | ), |
| 995 | 'selectors' => array( |
| 996 | $selector_callable( $scheme['prev-separator'] ) => 'height: {{SIZE}}px; min-height: {{SIZE}}px;', |
| 997 | ), |
| 998 | ) |
| 999 | ); |
| 1000 | $instance->add_control( |
| 1001 | 'jet_fb_progress_pages_tab--prev_separator_color', |
| 1002 | array( |
| 1003 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1004 | 'type' => Controls_Manager::COLOR, |
| 1005 | 'selectors' => array( |
| 1006 | $selector_callable( $scheme['prev-separator'] ) => 'background-color: {{VALUE}}', |
| 1007 | ), |
| 1008 | ) |
| 1009 | ); |
| 1010 | $instance->add_control( |
| 1011 | 'jet_fb_separator_prev_circle', |
| 1012 | array( |
| 1013 | 'label' => esc_html__( 'Circle', 'jet-form-builder' ), |
| 1014 | 'type' => Controls_Manager::HEADING, |
| 1015 | 'separator' => 'before', |
| 1016 | ) |
| 1017 | ); |
| 1018 | $this->add_border( |
| 1019 | $instance, |
| 1020 | 'jet_fb_progress_pages_tab--prev_separator_border', |
| 1021 | $selector_callable( $scheme['prev-circle'] ) |
| 1022 | ); |
| 1023 | $instance->end_controls_tab(); |
| 1024 | $instance->end_controls_tabs(); |
| 1025 | $instance->end_controls_section(); |
| 1026 | } |
| 1027 | |
| 1028 | public function booking_form_render( $result, $settings ) { |
| 1029 | $slug = $this->jet_form_builder_slug(); |
| 1030 | |
| 1031 | if ( empty( $settings['form_provider'] ) || $slug !== $settings['form_provider'] ) { |
| 1032 | return false; |
| 1033 | } |
| 1034 | if ( empty( $settings['form_id'] ) ) { |
| 1035 | return __( 'Please, select JetForm to show', 'jet-form-builder' ); |
| 1036 | } |
| 1037 | |
| 1038 | return jet_fb_render_form( $settings ); |
| 1039 | } |
| 1040 | |
| 1041 | /** |
| 1042 | * Register the widget controls. |
| 1043 | * |
| 1044 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 1045 | * |
| 1046 | * @since 1.1.0 |
| 1047 | * |
| 1048 | * @access protected |
| 1049 | */ |
| 1050 | protected function register_controls() { |
| 1051 | |
| 1052 | $options = Form_Arguments::get_options( true ); |
| 1053 | |
| 1054 | /** Form Settings */ |
| 1055 | $closure = function () use ( $options ) { |
| 1056 | $this->start_controls_section( |
| 1057 | 'section_ form_settings', |
| 1058 | array( |
| 1059 | 'label' => __( 'Form Settings', 'jet-form-builder' ), |
| 1060 | ) |
| 1061 | ); |
| 1062 | |
| 1063 | $this->add_control( |
| 1064 | 'form_id', |
| 1065 | array( |
| 1066 | 'label' => __( 'Choose Form', 'jet-form-builder' ), |
| 1067 | 'type' => Controls_Manager::SELECT, |
| 1068 | 'default' => '', |
| 1069 | 'label_block' => false, |
| 1070 | 'options' => Tools::get_forms_list_for_js( true ), |
| 1071 | ) |
| 1072 | ); |
| 1073 | |
| 1074 | $this->add_control( |
| 1075 | 'fields_layout', |
| 1076 | array( |
| 1077 | 'label' => __( 'Fields Layout', 'jet-form-builder' ), |
| 1078 | 'type' => Controls_Manager::SELECT, |
| 1079 | 'default' => __( 'column', 'jet-form-builder' ), |
| 1080 | 'options' => $options['fields_layout'], |
| 1081 | ) |
| 1082 | ); |
| 1083 | |
| 1084 | $this->add_control( |
| 1085 | 'required_mark', |
| 1086 | array( |
| 1087 | 'label' => __( 'Required Mark', 'jet-form-builder' ), |
| 1088 | 'type' => Controls_Manager::TEXT, |
| 1089 | 'default' => __( '*', 'jet-form-builder' ), |
| 1090 | ) |
| 1091 | ); |
| 1092 | |
| 1093 | $this->add_control( |
| 1094 | 'fields_label_tag', |
| 1095 | array( |
| 1096 | 'label' => __( 'Fields label HTML tag', 'jet-form-builder' ), |
| 1097 | 'type' => Controls_Manager::SELECT, |
| 1098 | 'default' => 'div', |
| 1099 | 'options' => $options['fields_label_tag'], |
| 1100 | ) |
| 1101 | ); |
| 1102 | |
| 1103 | $this->add_control( |
| 1104 | 'submit_type', |
| 1105 | array( |
| 1106 | 'label' => __( 'Submit Type', 'jet-form-builder' ), |
| 1107 | 'type' => Controls_Manager::SELECT, |
| 1108 | 'default' => __( 'reload', 'jet-form-builder' ), |
| 1109 | 'options' => $options['submit_type'], |
| 1110 | ) |
| 1111 | ); |
| 1112 | |
| 1113 | $this->add_control( |
| 1114 | 'enable_progress', |
| 1115 | array( |
| 1116 | 'label' => __( 'Enable form pages progress', 'jet-form-builder' ), |
| 1117 | 'type' => Controls_Manager::SWITCHER, |
| 1118 | 'label_on' => __( 'Yes', 'jet-form-builder' ), |
| 1119 | 'label_off' => __( 'No', 'jet-form-builder' ), |
| 1120 | 'return_value' => true, |
| 1121 | 'default' => false, |
| 1122 | ) |
| 1123 | ); |
| 1124 | |
| 1125 | $this->end_controls_section(); |
| 1126 | }; |
| 1127 | $closure(); |
| 1128 | |
| 1129 | /** Form Row */ |
| 1130 | $closure = function () { |
| 1131 | $this->start_controls_section( |
| 1132 | 'section_form_style', |
| 1133 | array( |
| 1134 | 'label' => __( 'Form Row', 'jet-form-builder' ), |
| 1135 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1136 | ) |
| 1137 | ); |
| 1138 | |
| 1139 | $this->add_responsive_control( |
| 1140 | 'form_row_gap_before', |
| 1141 | array( |
| 1142 | |
| 1143 | 'type' => Controls_Manager::SLIDER, |
| 1144 | 'label' => __( 'Gap Before', 'jet-form-builder' ), |
| 1145 | 'size_units' => array( 'px' ), |
| 1146 | 'range' => array( |
| 1147 | 'px' => array( |
| 1148 | 'min' => 0, |
| 1149 | 'max' => 100, |
| 1150 | ), |
| 1151 | ), |
| 1152 | 'selectors' => array( |
| 1153 | $this->selector( '-row' ) => 'margin-top: {{SIZE}}px;', |
| 1154 | ), |
| 1155 | ) |
| 1156 | ); |
| 1157 | |
| 1158 | $this->add_responsive_control( |
| 1159 | 'form_row_gap_after', |
| 1160 | array( |
| 1161 | |
| 1162 | 'type' => Controls_Manager::SLIDER, |
| 1163 | 'label' => __( 'Gap After', 'jet-form-builder' ), |
| 1164 | 'size_units' => array( 'px' ), |
| 1165 | 'range' => array( |
| 1166 | 'px' => array( |
| 1167 | 'min' => 0, |
| 1168 | 'max' => 100, |
| 1169 | ), |
| 1170 | ), |
| 1171 | 'selectors' => array( |
| 1172 | $this->selector( '-row' ) => 'margin-bottom: {{SIZE}}px;', |
| 1173 | ), |
| 1174 | ) |
| 1175 | ); |
| 1176 | |
| 1177 | $this->end_controls_section(); |
| 1178 | }; |
| 1179 | $closure(); |
| 1180 | |
| 1181 | /** Label */ |
| 1182 | $closure = function () { |
| 1183 | $this->start_controls_section( |
| 1184 | 'section_label_style', |
| 1185 | array( |
| 1186 | 'label' => __( 'Label', 'jet-form-builder' ), |
| 1187 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1188 | ) |
| 1189 | ); |
| 1190 | |
| 1191 | $this->add_responsive_control( |
| 1192 | 'form_label_margin', |
| 1193 | array( |
| 1194 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 1195 | 'type' => Controls_Manager::DIMENSIONS, |
| 1196 | 'size_units' => array( 'px' ), |
| 1197 | 'selectors' => array( |
| 1198 | $this->selector( '__label' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1199 | ), |
| 1200 | ) |
| 1201 | ); |
| 1202 | |
| 1203 | $this->add_responsive_control( |
| 1204 | 'form_label_padding', |
| 1205 | array( |
| 1206 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 1207 | 'type' => Controls_Manager::DIMENSIONS, |
| 1208 | 'size_units' => array( 'px' ), |
| 1209 | 'selectors' => array( |
| 1210 | $this->selector( '__label' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1211 | ), |
| 1212 | ) |
| 1213 | ); |
| 1214 | |
| 1215 | $this->add_responsive_control( |
| 1216 | 'form_label_alignment', |
| 1217 | array( |
| 1218 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 1219 | 'type' => Controls_Manager::CHOOSE, |
| 1220 | 'label_block' => false, |
| 1221 | 'default' => 'left', |
| 1222 | 'separator' => 'before', |
| 1223 | 'options' => array( |
| 1224 | 'left' => array( |
| 1225 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 1226 | 'icon' => 'eicon-h-align-left', |
| 1227 | ), |
| 1228 | 'center' => array( |
| 1229 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 1230 | 'icon' => 'eicon-h-align-center', |
| 1231 | ), |
| 1232 | 'right' => array( |
| 1233 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 1234 | 'icon' => 'eicon-h-align-right', |
| 1235 | ), |
| 1236 | ), |
| 1237 | 'selectors' => array( |
| 1238 | $this->selector( '__label' ) => 'text-align: {{VALUE}};', |
| 1239 | ), |
| 1240 | ) |
| 1241 | ); |
| 1242 | |
| 1243 | $this->add_group_control( |
| 1244 | Group_Control_Typography::get_type(), |
| 1245 | array( |
| 1246 | 'name' => 'form_label_typography', |
| 1247 | 'selector' => $this->selector( '__label' ), |
| 1248 | ) |
| 1249 | ); |
| 1250 | |
| 1251 | $this->add_control( |
| 1252 | 'form_label_color', |
| 1253 | array( |
| 1254 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1255 | 'type' => Controls_Manager::COLOR, |
| 1256 | 'selectors' => array( |
| 1257 | $this->selector( '__label' ) => 'color: {{VALUE}};', |
| 1258 | ), |
| 1259 | ) |
| 1260 | ); |
| 1261 | $this->add_control( |
| 1262 | 'form_label_bg_color', |
| 1263 | array( |
| 1264 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 1265 | 'type' => Controls_Manager::COLOR, |
| 1266 | 'selectors' => array( |
| 1267 | $this->selector( '__label' ) => 'background-color: {{VALUE}};', |
| 1268 | ), |
| 1269 | ) |
| 1270 | ); |
| 1271 | $this->add_border( |
| 1272 | $this, |
| 1273 | 'form_label_border', |
| 1274 | $this->selector( '__label' ) |
| 1275 | ); |
| 1276 | |
| 1277 | $this->add_control( |
| 1278 | 'divider__label__required_mark', |
| 1279 | array( |
| 1280 | 'label' => __( 'Required Mark', 'jet-form-builder' ), |
| 1281 | 'type' => Controls_Manager::HEADING, |
| 1282 | 'separator' => 'before', |
| 1283 | ) |
| 1284 | ); |
| 1285 | |
| 1286 | $this->add_group_control( |
| 1287 | Group_Control_Typography::get_type(), |
| 1288 | array( |
| 1289 | 'name' => 'form_required_typography', |
| 1290 | 'selector' => $this->selector( '__label .%s__required' ), |
| 1291 | ) |
| 1292 | ); |
| 1293 | $this->add_control( |
| 1294 | 'form_required_color', |
| 1295 | array( |
| 1296 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1297 | 'type' => Controls_Manager::COLOR, |
| 1298 | 'selectors' => array( |
| 1299 | $this->selector( '__label .%s__required' ) => 'color: {{VALUE}};', |
| 1300 | ), |
| 1301 | ) |
| 1302 | ); |
| 1303 | $this->end_controls_section(); |
| 1304 | }; |
| 1305 | $closure(); |
| 1306 | |
| 1307 | /** Description */ |
| 1308 | $closure = function () { |
| 1309 | $this->start_controls_section( |
| 1310 | 'section_description_style', |
| 1311 | array( |
| 1312 | 'label' => __( 'Description', 'jet-form-builder' ), |
| 1313 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1314 | ) |
| 1315 | ); |
| 1316 | $this->add_responsive_control( |
| 1317 | 'form_description_margin', |
| 1318 | array( |
| 1319 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 1320 | 'type' => Controls_Manager::DIMENSIONS, |
| 1321 | 'size_units' => array( 'px' ), |
| 1322 | 'selectors' => array( |
| 1323 | $this->selector( '__desc' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1324 | ), |
| 1325 | ) |
| 1326 | ); |
| 1327 | |
| 1328 | $this->add_responsive_control( |
| 1329 | 'form_description_padding', |
| 1330 | array( |
| 1331 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 1332 | 'type' => Controls_Manager::DIMENSIONS, |
| 1333 | 'size_units' => array( 'px' ), |
| 1334 | 'selectors' => array( |
| 1335 | $this->selector( '__desc' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1336 | ), |
| 1337 | ) |
| 1338 | ); |
| 1339 | |
| 1340 | $this->add_responsive_control( |
| 1341 | 'form_description_alignment', |
| 1342 | array( |
| 1343 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 1344 | 'type' => Controls_Manager::CHOOSE, |
| 1345 | 'label_block' => false, |
| 1346 | 'default' => 'left', |
| 1347 | 'separator' => 'before', |
| 1348 | 'options' => array( |
| 1349 | 'left' => array( |
| 1350 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 1351 | 'icon' => 'eicon-h-align-left', |
| 1352 | ), |
| 1353 | 'center' => array( |
| 1354 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 1355 | 'icon' => 'eicon-h-align-center', |
| 1356 | ), |
| 1357 | 'right' => array( |
| 1358 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 1359 | 'icon' => 'eicon-h-align-right', |
| 1360 | ), |
| 1361 | ), |
| 1362 | 'selectors' => array( |
| 1363 | $this->selector( '__desc' ) => 'text-align: {{VALUE}};', |
| 1364 | ), |
| 1365 | ) |
| 1366 | ); |
| 1367 | |
| 1368 | $this->add_group_control( |
| 1369 | Group_Control_Typography::get_type(), |
| 1370 | array( |
| 1371 | 'name' => 'form_description_typography', |
| 1372 | 'selector' => $this->selector( '__desc' ), |
| 1373 | ) |
| 1374 | ); |
| 1375 | |
| 1376 | $this->add_control( |
| 1377 | 'form_description_color', |
| 1378 | array( |
| 1379 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1380 | 'type' => Controls_Manager::COLOR, |
| 1381 | 'selectors' => array( |
| 1382 | $this->selector( '__desc' ) => 'color: {{VALUE}};', |
| 1383 | ), |
| 1384 | ) |
| 1385 | ); |
| 1386 | $this->add_control( |
| 1387 | 'form_description_bg_color', |
| 1388 | array( |
| 1389 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 1390 | 'type' => Controls_Manager::COLOR, |
| 1391 | 'selectors' => array( |
| 1392 | $this->selector( '__desc' ) => 'background-color: {{VALUE}};', |
| 1393 | ), |
| 1394 | ) |
| 1395 | ); |
| 1396 | $this->add_border( |
| 1397 | $this, |
| 1398 | 'form_description_border', |
| 1399 | $this->selector( '__desc' ) |
| 1400 | ); |
| 1401 | $this->end_controls_section(); |
| 1402 | }; |
| 1403 | $closure(); |
| 1404 | |
| 1405 | /** Checkbox & Radio Fields */ |
| 1406 | $closure = function () { |
| 1407 | $this->start_controls_section( |
| 1408 | 'section_checkradio_fields_style', |
| 1409 | array( |
| 1410 | 'label' => __( 'Checkbox & Radio Fields', 'jet-form-builder' ), |
| 1411 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1412 | 'show_label' => false, |
| 1413 | ) |
| 1414 | ); |
| 1415 | |
| 1416 | $this->add_responsive_control( |
| 1417 | 'checkradio_fields_layout', |
| 1418 | array( |
| 1419 | 'label' => __( 'Layout', 'jet-form-builder' ), |
| 1420 | 'type' => Controls_Manager::CHOOSE, |
| 1421 | 'label_block' => false, |
| 1422 | 'options' => array( |
| 1423 | 'inline-block' => array( |
| 1424 | 'title' => __( 'Horizontal', 'jet-form-builder' ), |
| 1425 | 'icon' => 'fa fa-ellipsis-h', |
| 1426 | ), |
| 1427 | 'block' => array( |
| 1428 | 'title' => __( 'Vertical', 'jet-form-builder' ), |
| 1429 | 'icon' => 'fa fa-bars', |
| 1430 | ), |
| 1431 | ), |
| 1432 | 'selectors' => array( |
| 1433 | $this->selector( '__field-wrap.checkradio-wrap' ) => 'display: {{VALUE}};', |
| 1434 | ), |
| 1435 | ) |
| 1436 | ); |
| 1437 | |
| 1438 | $this->add_group_control( |
| 1439 | Group_Control_Typography::get_type(), |
| 1440 | array( |
| 1441 | 'name' => 'checkradio_fields_typography', |
| 1442 | 'selector' => $this->selector( '__field-wrap label' ), |
| 1443 | ) |
| 1444 | ); |
| 1445 | |
| 1446 | $this->add_responsive_control( |
| 1447 | 'checkradio_fields_gap', |
| 1448 | array( |
| 1449 | 'label' => __( 'Gap between control and label', 'jet-form-builder' ), |
| 1450 | 'type' => Controls_Manager::SLIDER, |
| 1451 | 'size_units' => array( 'px' ), |
| 1452 | 'default' => array( |
| 1453 | 'size' => 8, |
| 1454 | ), |
| 1455 | 'range' => array( |
| 1456 | 'px' => array( |
| 1457 | 'min' => 0, |
| 1458 | 'max' => 50, |
| 1459 | ), |
| 1460 | ), |
| 1461 | 'selectors' => array( |
| 1462 | $this->selector( '__field-wrap.checkradio-wrap span' ) => 'gap: {{SIZE}}px;', |
| 1463 | ), |
| 1464 | ) |
| 1465 | ); |
| 1466 | $this->add_responsive_control( |
| 1467 | 'checkradio_fields_control_size', |
| 1468 | array( |
| 1469 | 'label' => __( 'Control Size', 'jet-form-builder' ), |
| 1470 | 'type' => Controls_Manager::SLIDER, |
| 1471 | 'size_units' => array( 'px' ), |
| 1472 | 'range' => array( |
| 1473 | 'px' => array( |
| 1474 | 'min' => 0, |
| 1475 | 'max' => 50, |
| 1476 | ), |
| 1477 | ), |
| 1478 | 'selectors' => array( |
| 1479 | $this->selector( '__field-wrap span::before' ) => 'font-size: {{SIZE}}px;', |
| 1480 | ), |
| 1481 | ) |
| 1482 | ); |
| 1483 | |
| 1484 | $this->add_control( |
| 1485 | 'checkradio_fields_option_label_heading', |
| 1486 | array( |
| 1487 | 'label' => __( 'Option label', 'jet-form-builder' ), |
| 1488 | 'type' => Controls_Manager::HEADING, |
| 1489 | 'separator' => 'before', |
| 1490 | ) |
| 1491 | ); |
| 1492 | |
| 1493 | $this->add_control( |
| 1494 | 'checkradio_fields_color', |
| 1495 | array( |
| 1496 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1497 | 'type' => Controls_Manager::COLOR, |
| 1498 | 'selectors' => array( |
| 1499 | $this->selector( '__field-wrap label' ) => 'color: {{VALUE}}', |
| 1500 | ), |
| 1501 | ) |
| 1502 | ); |
| 1503 | |
| 1504 | $this->add_control( |
| 1505 | 'checkradio_fields_background_color', |
| 1506 | array( |
| 1507 | 'label' => __( 'Background color', 'jet-form-builder' ), |
| 1508 | 'type' => Controls_Manager::COLOR, |
| 1509 | 'selectors' => array( |
| 1510 | $this->selector( '__field-wrap label' ) => 'background-color: {{VALUE}}', |
| 1511 | ), |
| 1512 | ) |
| 1513 | ); |
| 1514 | |
| 1515 | $this->start_controls_tabs( |
| 1516 | 'tab__checkradio_tabs_items', |
| 1517 | array( |
| 1518 | 'separator' => 'before', |
| 1519 | ) |
| 1520 | ); |
| 1521 | |
| 1522 | $this->start_controls_tab( |
| 1523 | 'tab__checkradio_control_color__normal', |
| 1524 | array( |
| 1525 | 'label' => __( 'Normal', 'jet-form-builder' ), |
| 1526 | ) |
| 1527 | ); |
| 1528 | |
| 1529 | $this->add_border( |
| 1530 | $this, |
| 1531 | 'tab__checkradio_control_border__normal', |
| 1532 | $this->selector( '__field-wrap span::before' ) |
| 1533 | ); |
| 1534 | |
| 1535 | $this->add_control( |
| 1536 | 'tab__checkradio_control_bg_color__normal', |
| 1537 | array( |
| 1538 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 1539 | 'type' => Controls_Manager::COLOR, |
| 1540 | 'selectors' => array( |
| 1541 | $this->selector( '__field-wrap label > span::before' ) => 'background-color: {{VALUE}};', |
| 1542 | ), |
| 1543 | ) |
| 1544 | ); |
| 1545 | |
| 1546 | $this->end_controls_tab(); |
| 1547 | |
| 1548 | $this->start_controls_tab( |
| 1549 | 'tab__checkradio_control_border__checked', |
| 1550 | array( |
| 1551 | 'label' => __( 'Checked', 'jet-form-builder' ), |
| 1552 | ) |
| 1553 | ); |
| 1554 | $this->add_border( |
| 1555 | $this, |
| 1556 | 'tab__checkradio_control_border__checked', |
| 1557 | $this->selector( '__field-wrap label :checked + span::before' ) |
| 1558 | ); |
| 1559 | $this->add_control( |
| 1560 | 'tab__checkradio_control_bg_color__checked', |
| 1561 | array( |
| 1562 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 1563 | 'type' => Controls_Manager::COLOR, |
| 1564 | 'selectors' => array( |
| 1565 | $this->selector( '__field-wrap label :checked + span::before' ) => 'background-color: {{VALUE}};', |
| 1566 | ), |
| 1567 | ) |
| 1568 | ); |
| 1569 | |
| 1570 | $this->end_controls_tab(); |
| 1571 | $this->end_controls_tabs(); |
| 1572 | $this->end_controls_section(); |
| 1573 | }; |
| 1574 | $closure(); |
| 1575 | |
| 1576 | /** Input Fields */ |
| 1577 | $closure = function () { |
| 1578 | |
| 1579 | $simple_input = '__field:not(.checkradio-field):not(.range-field):not(.%s-repeater):not(.wysiwyg-field)'; |
| 1580 | |
| 1581 | $this->start_controls_section( |
| 1582 | 'section_form_input_fields', |
| 1583 | array( |
| 1584 | 'label' => __( 'Input Fields', 'jet-form-builder' ), |
| 1585 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1586 | ) |
| 1587 | ); |
| 1588 | |
| 1589 | $this->add_group_control( |
| 1590 | Group_Control_Typography::get_type(), |
| 1591 | array( |
| 1592 | 'name' => 'fields_typography', |
| 1593 | 'selector' => $this->selector( $simple_input ), |
| 1594 | ) |
| 1595 | ); |
| 1596 | |
| 1597 | $this->add_control( |
| 1598 | 'fields_color', |
| 1599 | array( |
| 1600 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1601 | 'type' => Controls_Manager::COLOR, |
| 1602 | 'selectors' => array( |
| 1603 | $this->selector( $simple_input ) => 'color: {{VALUE}};', |
| 1604 | ), |
| 1605 | ) |
| 1606 | ); |
| 1607 | |
| 1608 | $this->add_control( |
| 1609 | 'fields_placeholder_color', |
| 1610 | array( |
| 1611 | 'label' => __( 'Placeholder Color', 'jet-form-builder' ), |
| 1612 | 'type' => Controls_Manager::COLOR, |
| 1613 | 'selectors' => array( |
| 1614 | $this->selector( ' ::-webkit-input-placeholder' ) => 'color: {{VALUE}};', |
| 1615 | $this->selector( ' ::-ms-input-placeholder' ) => 'color: {{VALUE}};', |
| 1616 | $this->selector( ' ::-moz-placeholder' ) => 'color: {{VALUE}};', |
| 1617 | $this->selector( ' :-moz-placeholder' ) => 'color: {{VALUE}};', |
| 1618 | ), |
| 1619 | ) |
| 1620 | ); |
| 1621 | |
| 1622 | $this->add_control( |
| 1623 | 'fields_background_color', |
| 1624 | array( |
| 1625 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 1626 | 'type' => Controls_Manager::COLOR, |
| 1627 | 'selectors' => array( |
| 1628 | $this->selector( $simple_input ) => 'background-color: {{VALUE}};', |
| 1629 | ), |
| 1630 | ) |
| 1631 | ); |
| 1632 | |
| 1633 | $this->add_responsive_control( |
| 1634 | 'fields_padding', |
| 1635 | array( |
| 1636 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 1637 | 'type' => Controls_Manager::DIMENSIONS, |
| 1638 | 'size_units' => array( 'px' ), |
| 1639 | 'selectors' => array( |
| 1640 | $this->selector( $simple_input ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1641 | ), |
| 1642 | ) |
| 1643 | ); |
| 1644 | |
| 1645 | $this->add_responsive_control( |
| 1646 | 'fields_margin', |
| 1647 | array( |
| 1648 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 1649 | 'type' => Controls_Manager::DIMENSIONS, |
| 1650 | 'size_units' => array( 'px' ), |
| 1651 | 'selectors' => array( |
| 1652 | $this->selector( $simple_input ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1653 | ), |
| 1654 | ) |
| 1655 | ); |
| 1656 | |
| 1657 | $this->add_group_control( |
| 1658 | Group_Control_Border::get_type(), |
| 1659 | array( |
| 1660 | 'name' => 'fields_border', |
| 1661 | 'label' => __( 'Border', 'jet-form-builder' ), |
| 1662 | 'placeholder' => '1px', |
| 1663 | 'selector' => $this->selector( $simple_input ), |
| 1664 | ) |
| 1665 | ); |
| 1666 | |
| 1667 | $this->add_responsive_control( |
| 1668 | 'fields_border_radius', |
| 1669 | array( |
| 1670 | 'label' => __( 'Border Radius', 'jet-form-builder' ), |
| 1671 | 'type' => Controls_Manager::DIMENSIONS, |
| 1672 | 'size_units' => array( 'px', '%' ), |
| 1673 | 'selectors' => array( |
| 1674 | $this->selector( $simple_input ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1675 | ), |
| 1676 | ) |
| 1677 | ); |
| 1678 | |
| 1679 | $this->add_group_control( |
| 1680 | Group_Control_Box_Shadow::get_type(), |
| 1681 | array( |
| 1682 | 'name' => 'fields_box_shadow', |
| 1683 | 'selector' => $this->selector( $simple_input ), |
| 1684 | ) |
| 1685 | ); |
| 1686 | |
| 1687 | $this->add_responsive_control( |
| 1688 | 'fields_width', |
| 1689 | array( |
| 1690 | 'label' => __( 'Fields width', 'jet-form-builder' ), |
| 1691 | 'type' => Controls_Manager::SLIDER, |
| 1692 | 'size_units' => array( 'px', '%' ), |
| 1693 | 'range' => array( |
| 1694 | 'px' => array( |
| 1695 | 'min' => 50, |
| 1696 | 'max' => 1000, |
| 1697 | ), |
| 1698 | ), |
| 1699 | 'selectors' => array( |
| 1700 | $this->selector( $simple_input ) => 'max-width: {{SIZE}}{{UNIT}};', |
| 1701 | ), |
| 1702 | ) |
| 1703 | ); |
| 1704 | |
| 1705 | $this->add_responsive_control( |
| 1706 | 'fields_textarea_height', |
| 1707 | array( |
| 1708 | 'label' => __( 'Textarea Height', 'jet-form-builder' ), |
| 1709 | 'type' => Controls_Manager::SLIDER, |
| 1710 | 'size_units' => array( 'px' ), |
| 1711 | 'range' => array( |
| 1712 | 'px' => array( |
| 1713 | 'min' => 10, |
| 1714 | 'max' => 500, |
| 1715 | ), |
| 1716 | ), |
| 1717 | 'selectors' => array( |
| 1718 | $this->selector( '__field.textarea-field' ) => 'height:{{SIZE}}px;min-height:{{SIZE}}px;', |
| 1719 | ), |
| 1720 | ) |
| 1721 | ); |
| 1722 | |
| 1723 | $this->add_control( |
| 1724 | 'fields_color_scheme', |
| 1725 | array( |
| 1726 | 'label' => __( 'Color Scheme', 'jet-form-builder' ), |
| 1727 | 'type' => Controls_Manager::SELECT, |
| 1728 | 'description' => __( 'Affects default browser UI elements like date and time icons, UI etc.', 'jet-form-builder' ), |
| 1729 | 'default' => 'normal', |
| 1730 | 'options' => array( |
| 1731 | 'normal' => __( 'Normal', 'jet-form-builder' ), |
| 1732 | 'light' => __( 'Light', 'jet-form-builder' ), |
| 1733 | 'dark' => __( 'Dark', 'jet-form-builder' ), |
| 1734 | ), |
| 1735 | 'selectors' => array( |
| 1736 | $this->selector( ' input' ) => 'color-scheme: {{VALUE}};', |
| 1737 | ), |
| 1738 | ) |
| 1739 | ); |
| 1740 | |
| 1741 | $this->end_controls_section(); |
| 1742 | }; |
| 1743 | $closure(); |
| 1744 | |
| 1745 | /** Calculated Fields */ |
| 1746 | $closure = function () { |
| 1747 | $this->start_controls_section( |
| 1748 | 'section_calc_fields_style', |
| 1749 | array( |
| 1750 | 'label' => __( 'Calculated Fields', 'jet-form-builder' ), |
| 1751 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1752 | 'show_label' => false, |
| 1753 | ) |
| 1754 | ); |
| 1755 | |
| 1756 | $this->add_group_control( |
| 1757 | Group_Control_Typography::get_type(), |
| 1758 | array( |
| 1759 | 'name' => 'calc_fields_typography', |
| 1760 | 'selector' => $this->selector( '__calculated-field' ), |
| 1761 | ) |
| 1762 | ); |
| 1763 | |
| 1764 | $this->add_control( |
| 1765 | 'calc_fields_color', |
| 1766 | array( |
| 1767 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1768 | 'type' => Controls_Manager::COLOR, |
| 1769 | 'selectors' => array( |
| 1770 | $this->selector( '__calculated-field' ) => 'color: {{VALUE}}', |
| 1771 | ), |
| 1772 | ) |
| 1773 | ); |
| 1774 | |
| 1775 | $this->add_control( |
| 1776 | 'calc_fields_prefix_color', |
| 1777 | array( |
| 1778 | 'label' => __( 'Prefix Color', 'jet-form-builder' ), |
| 1779 | 'type' => Controls_Manager::COLOR, |
| 1780 | 'selectors' => array( |
| 1781 | $this->selector( '__calculated-field-prefix' ) => 'color: {{VALUE}}', |
| 1782 | ), |
| 1783 | ) |
| 1784 | ); |
| 1785 | |
| 1786 | $this->add_responsive_control( |
| 1787 | 'calc_fields_prefix_size', |
| 1788 | array( |
| 1789 | 'label' => __( 'Prefix size', 'jet-form-builder' ), |
| 1790 | 'type' => Controls_Manager::SLIDER, |
| 1791 | 'size_units' => array( 'px' ), |
| 1792 | 'range' => array( |
| 1793 | 'px' => array( |
| 1794 | 'min' => 10, |
| 1795 | 'max' => 50, |
| 1796 | ), |
| 1797 | ), |
| 1798 | 'selectors' => array( |
| 1799 | $this->selector( '__calculated-field-prefix' ) => 'font-size: {{SIZE}}px;', |
| 1800 | ), |
| 1801 | ) |
| 1802 | ); |
| 1803 | |
| 1804 | $this->add_control( |
| 1805 | 'calc_fields_suffix_color', |
| 1806 | array( |
| 1807 | 'label' => __( 'Suffix Color', 'jet-form-builder' ), |
| 1808 | 'type' => Controls_Manager::COLOR, |
| 1809 | 'selectors' => array( |
| 1810 | $this->selector( '__calculated-field-suffix' ) => 'color: {{VALUE}}', |
| 1811 | ), |
| 1812 | ) |
| 1813 | ); |
| 1814 | |
| 1815 | $this->add_responsive_control( |
| 1816 | 'calc_fields_suffix_size', |
| 1817 | array( |
| 1818 | 'label' => __( 'Suffix size', 'jet-form-builder' ), |
| 1819 | 'type' => Controls_Manager::SLIDER, |
| 1820 | 'size_units' => array( 'px' ), |
| 1821 | 'range' => array( |
| 1822 | 'px' => array( |
| 1823 | 'min' => 10, |
| 1824 | 'max' => 50, |
| 1825 | ), |
| 1826 | ), |
| 1827 | 'selectors' => array( |
| 1828 | $this->selector( '__calculated-field-suffix' ) => 'font-size: {{SIZE}}px;', |
| 1829 | ), |
| 1830 | ) |
| 1831 | ); |
| 1832 | |
| 1833 | $this->add_control( |
| 1834 | 'calc_fields_background_color', |
| 1835 | array( |
| 1836 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 1837 | 'type' => Controls_Manager::COLOR, |
| 1838 | 'selectors' => array( |
| 1839 | $this->selector( '__calculated-field' ) => 'background-color: {{VALUE}}', |
| 1840 | ), |
| 1841 | ) |
| 1842 | ); |
| 1843 | |
| 1844 | $this->add_responsive_control( |
| 1845 | 'calc_fields_padding', |
| 1846 | array( |
| 1847 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 1848 | 'type' => Controls_Manager::DIMENSIONS, |
| 1849 | 'size_units' => array( 'px' ), |
| 1850 | 'selectors' => array( |
| 1851 | $this->selector( '__calculated-field' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1852 | ), |
| 1853 | ) |
| 1854 | ); |
| 1855 | |
| 1856 | $this->add_responsive_control( |
| 1857 | 'calc_fields_margin', |
| 1858 | array( |
| 1859 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 1860 | 'type' => Controls_Manager::DIMENSIONS, |
| 1861 | 'size_units' => array( 'px' ), |
| 1862 | 'selectors' => array( |
| 1863 | $this->selector( '__calculated-field' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1864 | ), |
| 1865 | ) |
| 1866 | ); |
| 1867 | |
| 1868 | $this->add_group_control( |
| 1869 | Group_Control_Border::get_type(), |
| 1870 | array( |
| 1871 | 'name' => 'calc_fields_border', |
| 1872 | 'label' => __( 'Border', 'jet-form-builder' ), |
| 1873 | 'placeholder' => '1px', |
| 1874 | 'selector' => $this->selector( '__calculated-field' ), |
| 1875 | ) |
| 1876 | ); |
| 1877 | |
| 1878 | $this->add_responsive_control( |
| 1879 | 'calc_fields_border_radius', |
| 1880 | array( |
| 1881 | 'label' => __( 'Border Radius', 'jet-form-builder' ), |
| 1882 | 'type' => Controls_Manager::DIMENSIONS, |
| 1883 | 'size_units' => array( 'px', '%' ), |
| 1884 | 'selectors' => array( |
| 1885 | $this->selector( '__calculated-field' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1886 | ), |
| 1887 | ) |
| 1888 | ); |
| 1889 | |
| 1890 | $this->add_responsive_control( |
| 1891 | 'calc_fields_flex_align', |
| 1892 | array( |
| 1893 | 'label' => __( 'Content Align', 'jet-form-builder' ), |
| 1894 | 'type' => Controls_Manager::SELECT, |
| 1895 | 'options' => array( |
| 1896 | '' => __( 'Default', 'jet-form-builder' ), |
| 1897 | 'start' => __( 'Left', 'jet-form-builder' ), |
| 1898 | 'center' => __( 'Center', 'jet-form-builder' ), |
| 1899 | 'end' => __( 'Right', 'jet-form-builder' ), |
| 1900 | 'space-between' => __( 'Space Between', 'jet-form-builder' ), |
| 1901 | 'space-evenly' => __( 'Space Evenly', 'jet-form-builder' ), |
| 1902 | 'space-around' => __( 'Space Around', 'jet-form-builder' ), |
| 1903 | ), |
| 1904 | 'selectors' => array( |
| 1905 | $this->selector( '__calculated-field' ) => 'justify-content: {{VALUE}};', |
| 1906 | ), |
| 1907 | ) |
| 1908 | ); |
| 1909 | |
| 1910 | $this->end_controls_section(); |
| 1911 | }; |
| 1912 | $closure(); |
| 1913 | |
| 1914 | /** Range Fields */ |
| 1915 | $closure = function () { |
| 1916 | $this->start_controls_section( |
| 1917 | 'section_range_fields_style', |
| 1918 | array( |
| 1919 | 'label' => __( 'Range Fields', 'jet-form-builder' ), |
| 1920 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1921 | ) |
| 1922 | ); |
| 1923 | |
| 1924 | $this->add_control( |
| 1925 | 'range_max_width', |
| 1926 | array( |
| 1927 | 'label' => esc_html__( 'Max Width', 'jet-form-builder' ), |
| 1928 | 'type' => Controls_Manager::SLIDER, |
| 1929 | 'size_units' => array( 'px', '%' ), |
| 1930 | 'range' => array( |
| 1931 | 'px' => array( |
| 1932 | 'min' => 1, |
| 1933 | 'max' => 1000, |
| 1934 | ), |
| 1935 | ), |
| 1936 | 'selectors' => array( |
| 1937 | $this->selector( '__field-wrap.range-wrap' ) => 'max-width: {{SIZE}}{{UNIT}};', |
| 1938 | ), |
| 1939 | ) |
| 1940 | ); |
| 1941 | |
| 1942 | $this->add_control( |
| 1943 | 'range_slider_heading', |
| 1944 | array( |
| 1945 | 'label' => esc_html__( 'Slider', 'jet-form-builder' ), |
| 1946 | 'type' => Controls_Manager::HEADING, |
| 1947 | 'separator' => 'before', |
| 1948 | ) |
| 1949 | ); |
| 1950 | |
| 1951 | $this->add_control( |
| 1952 | 'track_height', |
| 1953 | array( |
| 1954 | 'label' => esc_html__( 'Track Height', 'jet-form-builder' ), |
| 1955 | 'type' => Controls_Manager::SLIDER, |
| 1956 | 'size_units' => array( 'px' ), |
| 1957 | 'range' => array( |
| 1958 | 'px' => array( |
| 1959 | 'min' => 1, |
| 1960 | 'max' => 20, |
| 1961 | ), |
| 1962 | ), |
| 1963 | 'selectors' => array( |
| 1964 | $this->selector( ' .range-field::-webkit-slider-runnable-track' ) => 'height: {{SIZE}}{{UNIT}};', |
| 1965 | $this->selector( ' .range-field::-moz-range-track' ) => 'height: {{SIZE}}{{UNIT}};', |
| 1966 | $this->selector( ' .range-field::-ms-track' ) => 'height: {{SIZE}}{{UNIT}};', |
| 1967 | $this->selector( ' .range-field::-webkit-slider-thumb' ) => 'margin-top: calc( (18px - {{SIZE}}{{UNIT}})/-2 )', |
| 1968 | ), |
| 1969 | ) |
| 1970 | ); |
| 1971 | |
| 1972 | $this->add_control( |
| 1973 | 'thumb_size', |
| 1974 | array( |
| 1975 | 'label' => esc_html__( 'Thumb Size', 'jet-form-builder' ), |
| 1976 | 'type' => Controls_Manager::SLIDER, |
| 1977 | 'size_units' => array( 'px' ), |
| 1978 | 'range' => array( |
| 1979 | 'px' => array( |
| 1980 | 'min' => 1, |
| 1981 | 'max' => 50, |
| 1982 | ), |
| 1983 | ), |
| 1984 | 'selectors' => array( |
| 1985 | $this->selector( '__field.range-field' ) => 'min-height: {{SIZE}}{{UNIT}};', |
| 1986 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; margin-top: calc( ({{SIZE}}{{UNIT}} - 4px)/-2 )', |
| 1987 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1988 | $this->selector( '__field.range-field::-ms-thumb' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1989 | ), |
| 1990 | ) |
| 1991 | ); |
| 1992 | |
| 1993 | $this->add_control( |
| 1994 | 'thumb_indent', |
| 1995 | array( |
| 1996 | 'type' => Controls_Manager::HIDDEN, |
| 1997 | 'default' => 'style', |
| 1998 | 'selectors' => array( |
| 1999 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'margin-top: calc( ({{thumb_size.SIZE}}{{thumb_size.UNIT}} - {{track_height.SIZE}}{{track_height.UNIT}})/-2 )', |
| 2000 | ), |
| 2001 | ) |
| 2002 | ); |
| 2003 | |
| 2004 | $this->add_control( |
| 2005 | 'track_border_radius', |
| 2006 | array( |
| 2007 | 'label' => esc_html__( 'Track Border Radius', 'jet-form-builder' ), |
| 2008 | 'type' => Controls_Manager::DIMENSIONS, |
| 2009 | 'size_units' => array( 'px', '%' ), |
| 2010 | 'selectors' => array( |
| 2011 | $this->selector( '__field.range-field::-webkit-slider-runnable-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2012 | $this->selector( '__field.range-field::-moz-range-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2013 | $this->selector( '__field.range-field::-ms-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2014 | ), |
| 2015 | ) |
| 2016 | ); |
| 2017 | |
| 2018 | $this->add_control( |
| 2019 | 'thumb_border_radius', |
| 2020 | array( |
| 2021 | 'label' => esc_html__( 'Thumb Border Radius', 'jet-form-builder' ), |
| 2022 | 'type' => Controls_Manager::DIMENSIONS, |
| 2023 | 'size_units' => array( 'px', '%' ), |
| 2024 | 'selectors' => array( |
| 2025 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2026 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2027 | $this->selector( '__field.range-field::-ms-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2028 | ), |
| 2029 | ) |
| 2030 | ); |
| 2031 | |
| 2032 | $this->add_control( |
| 2033 | 'track_bg_color', |
| 2034 | array( |
| 2035 | 'label' => esc_html__( 'Track Color', 'jet-form-builder' ), |
| 2036 | 'type' => Controls_Manager::COLOR, |
| 2037 | 'selectors' => array( |
| 2038 | $this->selector( '__field.range-field::-webkit-slider-runnable-track' ) => 'background-color: {{VALUE}};', |
| 2039 | $this->selector( '__field.range-field::-moz-range-track' ) => 'background-color: {{VALUE}};', |
| 2040 | $this->selector( '__field.range-field::-ms-track' ) => 'background-color: {{VALUE}};', |
| 2041 | ), |
| 2042 | ) |
| 2043 | ); |
| 2044 | |
| 2045 | $this->add_control( |
| 2046 | 'thumb_bg_color', |
| 2047 | array( |
| 2048 | 'label' => esc_html__( 'Thumb Color', 'jet-form-builder' ), |
| 2049 | 'type' => Controls_Manager::COLOR, |
| 2050 | 'selectors' => array( |
| 2051 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'background-color: {{VALUE}};', |
| 2052 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'background-color: {{VALUE}};', |
| 2053 | $this->selector( '__field.range-field::-ms-thumb' ) => 'background-color: {{VALUE}};', |
| 2054 | ), |
| 2055 | ) |
| 2056 | ); |
| 2057 | |
| 2058 | $this->add_control( |
| 2059 | 'range_value_heading', |
| 2060 | array( |
| 2061 | 'label' => esc_html__( 'Value', 'jet-form-builder' ), |
| 2062 | 'type' => Controls_Manager::HEADING, |
| 2063 | 'separator' => 'before', |
| 2064 | ) |
| 2065 | ); |
| 2066 | |
| 2067 | $this->add_group_control( |
| 2068 | Group_Control_Typography::get_type(), |
| 2069 | array( |
| 2070 | 'name' => 'range_value_typography', |
| 2071 | 'selector' => $this->selector( '__field-value.range-value' ), |
| 2072 | ) |
| 2073 | ); |
| 2074 | |
| 2075 | $this->add_control( |
| 2076 | 'range_value_color', |
| 2077 | array( |
| 2078 | 'label' => esc_html__( 'Color', 'jet-form-builder' ), |
| 2079 | 'type' => Controls_Manager::COLOR, |
| 2080 | 'selectors' => array( |
| 2081 | $this->selector( '__field-value.range-value' ) => 'color: {{VALUE}};', |
| 2082 | ), |
| 2083 | ) |
| 2084 | ); |
| 2085 | |
| 2086 | $this->add_responsive_control( |
| 2087 | 'range_prefix_value_size', |
| 2088 | array( |
| 2089 | 'label' => __( 'Prefix size', 'jet-form-builder' ), |
| 2090 | 'type' => Controls_Manager::SLIDER, |
| 2091 | 'size_units' => array( 'px', 'em', 'rem' ), |
| 2092 | 'range' => array( |
| 2093 | 'px' => array( |
| 2094 | 'min' => 10, |
| 2095 | 'max' => 50, |
| 2096 | ), |
| 2097 | ), |
| 2098 | 'selectors' => array( |
| 2099 | $this->selector( '__field-value.range-value .%s__field-value-prefix' ) => 'font-size: {{SIZE}}px;', |
| 2100 | ), |
| 2101 | 'separator' => 'before', |
| 2102 | ) |
| 2103 | ); |
| 2104 | |
| 2105 | $this->add_control( |
| 2106 | 'range_prefix_value_color', |
| 2107 | array( |
| 2108 | 'label' => __( 'Prefix Color', 'jet-form-builder' ), |
| 2109 | 'type' => Controls_Manager::COLOR, |
| 2110 | 'selectors' => array( |
| 2111 | $this->selector( '__field-value.range-value .%s__field-value-prefix' ) => 'color: {{VALUE}};', |
| 2112 | ), |
| 2113 | ) |
| 2114 | ); |
| 2115 | |
| 2116 | $this->add_responsive_control( |
| 2117 | 'range_suffix_value_size', |
| 2118 | array( |
| 2119 | 'label' => __( 'Suffix size', 'jet-form-builder' ), |
| 2120 | 'type' => Controls_Manager::SLIDER, |
| 2121 | 'size_units' => array( 'px', 'em', 'rem' ), |
| 2122 | 'range' => array( |
| 2123 | 'px' => array( |
| 2124 | 'min' => 10, |
| 2125 | 'max' => 50, |
| 2126 | ), |
| 2127 | ), |
| 2128 | 'selectors' => array( |
| 2129 | $this->selector( '__field-value.range-value .%s__field-value-suffix' ) => 'font-size: {{SIZE}}px;', |
| 2130 | ), |
| 2131 | 'separator' => 'before', |
| 2132 | ) |
| 2133 | ); |
| 2134 | |
| 2135 | $this->add_control( |
| 2136 | 'range_suffix_value_color', |
| 2137 | array( |
| 2138 | 'label' => __( 'Suffix Color', 'jet-form-builder' ), |
| 2139 | 'type' => Controls_Manager::COLOR, |
| 2140 | 'selectors' => array( |
| 2141 | $this->selector( '__field-value.range-value .%s__field-value-suffix' ) => 'color: {{VALUE}};', |
| 2142 | ), |
| 2143 | ) |
| 2144 | ); |
| 2145 | |
| 2146 | $this->end_controls_section(); |
| 2147 | }; |
| 2148 | $closure(); |
| 2149 | |
| 2150 | /** Heading Fields */ |
| 2151 | $closure = function () { |
| 2152 | $this->start_controls_section( |
| 2153 | 'section_headings_style', |
| 2154 | array( |
| 2155 | 'label' => __( 'Heading', 'jet-form-builder' ), |
| 2156 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2157 | 'show_label' => false, |
| 2158 | ) |
| 2159 | ); |
| 2160 | |
| 2161 | $this->add_control( |
| 2162 | 'field_heading_styles_heading', |
| 2163 | array( |
| 2164 | 'label' => esc_html__( 'Label', 'jet-form-builder' ), |
| 2165 | 'type' => Controls_Manager::HEADING, |
| 2166 | 'separator' => 'before', |
| 2167 | ) |
| 2168 | ); |
| 2169 | |
| 2170 | $this->add_group_control( |
| 2171 | Group_Control_Typography::get_type(), |
| 2172 | array( |
| 2173 | 'name' => 'field_heading_typography', |
| 2174 | 'selector' => $this->selector( '__heading' ), |
| 2175 | ) |
| 2176 | ); |
| 2177 | |
| 2178 | $this->add_control( |
| 2179 | 'fields_heading_color', |
| 2180 | array( |
| 2181 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 2182 | 'type' => Controls_Manager::COLOR, |
| 2183 | 'selectors' => array( |
| 2184 | $this->selector( '__heading' ) => 'color: {{VALUE}}', |
| 2185 | ), |
| 2186 | ) |
| 2187 | ); |
| 2188 | |
| 2189 | $this->add_responsive_control( |
| 2190 | 'fields_heading_gap', |
| 2191 | array( |
| 2192 | 'label' => __( 'Gap', 'jet-form-builder' ), |
| 2193 | 'type' => Controls_Manager::DIMENSIONS, |
| 2194 | 'size_units' => array( 'px' ), |
| 2195 | 'selectors' => array( |
| 2196 | $this->selector( '__heading' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2197 | ), |
| 2198 | ) |
| 2199 | ); |
| 2200 | |
| 2201 | $this->add_control( |
| 2202 | 'field_heading_styles_desc', |
| 2203 | array( |
| 2204 | 'label' => esc_html__( 'Description', 'jet-form-builder' ), |
| 2205 | 'type' => Controls_Manager::HEADING, |
| 2206 | 'separator' => 'before', |
| 2207 | ) |
| 2208 | ); |
| 2209 | |
| 2210 | $this->add_group_control( |
| 2211 | Group_Control_Typography::get_type(), |
| 2212 | array( |
| 2213 | 'name' => 'field_desc_typography', |
| 2214 | 'selector' => $this->selector( '__heading-desc' ), |
| 2215 | ) |
| 2216 | ); |
| 2217 | |
| 2218 | $this->add_control( |
| 2219 | 'fields_desc_color', |
| 2220 | array( |
| 2221 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 2222 | 'type' => Controls_Manager::COLOR, |
| 2223 | 'selectors' => array( |
| 2224 | $this->selector( '__heading-desc' ) => 'color: {{VALUE}}', |
| 2225 | ), |
| 2226 | ) |
| 2227 | ); |
| 2228 | |
| 2229 | $this->add_responsive_control( |
| 2230 | 'fields_heading_desc_gap', |
| 2231 | array( |
| 2232 | 'label' => __( 'Gap', 'jet-form-builder' ), |
| 2233 | 'type' => Controls_Manager::DIMENSIONS, |
| 2234 | 'size_units' => array( 'px' ), |
| 2235 | 'selectors' => array( |
| 2236 | $this->selector( '__heading-desc' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2237 | ), |
| 2238 | ) |
| 2239 | ); |
| 2240 | |
| 2241 | $this->end_controls_section(); |
| 2242 | }; |
| 2243 | $closure(); |
| 2244 | |
| 2245 | /** Repeater */ |
| 2246 | $closure = function () { |
| 2247 | $this->start_controls_section( |
| 2248 | 'section_repeater_style', |
| 2249 | array( |
| 2250 | 'label' => __( 'Repeater', 'jet-form-builder' ), |
| 2251 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2252 | 'show_label' => false, |
| 2253 | ) |
| 2254 | ); |
| 2255 | |
| 2256 | $this->add_control( |
| 2257 | 'field_repeater_row_desc', |
| 2258 | array( |
| 2259 | 'label' => esc_html__( 'Repeater row', 'jet-form-builder' ), |
| 2260 | 'type' => Controls_Manager::HEADING, |
| 2261 | 'separator' => 'before', |
| 2262 | ) |
| 2263 | ); |
| 2264 | |
| 2265 | $this->add_responsive_control( |
| 2266 | 'booking_form_repeater_row_padding', |
| 2267 | array( |
| 2268 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2269 | 'type' => Controls_Manager::DIMENSIONS, |
| 2270 | 'size_units' => array( 'px', '%', 'em' ), |
| 2271 | 'selectors' => array( |
| 2272 | $this->selector( '-repeater__row' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2273 | ), |
| 2274 | ) |
| 2275 | ); |
| 2276 | |
| 2277 | $this->add_control( |
| 2278 | 'field_repeater_new_desc', |
| 2279 | array( |
| 2280 | 'label' => esc_html__( 'New item button', 'jet-form-builder' ), |
| 2281 | 'type' => Controls_Manager::HEADING, |
| 2282 | 'separator' => 'before', |
| 2283 | ) |
| 2284 | ); |
| 2285 | |
| 2286 | $this->start_controls_tabs( 'tabs_booking_form_repeater_style' ); |
| 2287 | |
| 2288 | $this->start_controls_tab( |
| 2289 | 'booking_form_repeater_normal', |
| 2290 | array( |
| 2291 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 2292 | ) |
| 2293 | ); |
| 2294 | |
| 2295 | $this->add_control( |
| 2296 | 'booking_form_repeater_bg_color', |
| 2297 | array( |
| 2298 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2299 | 'type' => Controls_Manager::COLOR, |
| 2300 | 'selectors' => array( |
| 2301 | $this->selector( '-repeater__new' ) => 'background-color: {{VALUE}};', |
| 2302 | ), |
| 2303 | ) |
| 2304 | ); |
| 2305 | |
| 2306 | $this->add_control( |
| 2307 | 'booking_form_repeater_color', |
| 2308 | array( |
| 2309 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2310 | 'type' => Controls_Manager::COLOR, |
| 2311 | 'selectors' => array( |
| 2312 | $this->selector( '-repeater__new' ) => 'color: {{VALUE}};', |
| 2313 | ), |
| 2314 | ) |
| 2315 | ); |
| 2316 | |
| 2317 | $this->end_controls_tab(); |
| 2318 | |
| 2319 | $this->start_controls_tab( |
| 2320 | 'booking_form_repeater_hover', |
| 2321 | array( |
| 2322 | 'label' => esc_html__( 'Hover', 'jet-form-builder' ), |
| 2323 | ) |
| 2324 | ); |
| 2325 | |
| 2326 | $this->add_control( |
| 2327 | 'booking_form_repeater_bg_color_hover', |
| 2328 | array( |
| 2329 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2330 | 'type' => Controls_Manager::COLOR, |
| 2331 | 'selectors' => array( |
| 2332 | $this->selector( '-repeater__new:hover' ) => 'background-color: {{VALUE}};', |
| 2333 | ), |
| 2334 | ) |
| 2335 | ); |
| 2336 | |
| 2337 | $this->add_control( |
| 2338 | 'booking_form_repeater_color_hover', |
| 2339 | array( |
| 2340 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2341 | 'type' => Controls_Manager::COLOR, |
| 2342 | 'selectors' => array( |
| 2343 | $this->selector( '-repeater__new:hover' ) => 'color: {{VALUE}}', |
| 2344 | ), |
| 2345 | ) |
| 2346 | ); |
| 2347 | |
| 2348 | $this->add_control( |
| 2349 | 'booking_form_repeater_hover_border_color', |
| 2350 | array( |
| 2351 | 'label' => esc_html__( 'Border Color', 'jet-form-builder' ), |
| 2352 | 'type' => Controls_Manager::COLOR, |
| 2353 | 'condition' => array( |
| 2354 | 'booking_form_repeater_border_border!' => '', |
| 2355 | ), |
| 2356 | 'selectors' => array( |
| 2357 | $this->selector( '-repeater__new:hover' ) => 'border-color: {{VALUE}};', |
| 2358 | ), |
| 2359 | ) |
| 2360 | ); |
| 2361 | |
| 2362 | $this->end_controls_tab(); |
| 2363 | |
| 2364 | $this->end_controls_tabs(); |
| 2365 | |
| 2366 | $this->add_group_control( |
| 2367 | Group_Control_Typography::get_type(), |
| 2368 | array( |
| 2369 | 'name' => 'booking_form_repeater_typography', |
| 2370 | 'selector' => $this->selector( '-repeater__new' ), |
| 2371 | 'fields_options' => array( |
| 2372 | 'typography' => array( |
| 2373 | 'separator' => 'before', |
| 2374 | ), |
| 2375 | ), |
| 2376 | ) |
| 2377 | ); |
| 2378 | |
| 2379 | $this->add_responsive_control( |
| 2380 | 'booking_form_repeater_padding', |
| 2381 | array( |
| 2382 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2383 | 'type' => Controls_Manager::DIMENSIONS, |
| 2384 | 'size_units' => array( 'px', '%', 'em' ), |
| 2385 | 'selectors' => array( |
| 2386 | $this->selector( '-repeater__new' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2387 | ), |
| 2388 | ) |
| 2389 | ); |
| 2390 | |
| 2391 | $this->add_responsive_control( |
| 2392 | 'booking_form_repeater_margin', |
| 2393 | array( |
| 2394 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2395 | 'type' => Controls_Manager::DIMENSIONS, |
| 2396 | 'size_units' => array( 'px', '%', 'em' ), |
| 2397 | 'selectors' => array( |
| 2398 | $this->selector( '-repeater__new' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2399 | ), |
| 2400 | ) |
| 2401 | ); |
| 2402 | |
| 2403 | $this->add_group_control( |
| 2404 | Group_Control_Border::get_type(), |
| 2405 | array( |
| 2406 | 'name' => 'booking_form_repeater_border', |
| 2407 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2408 | 'placeholder' => '1px', |
| 2409 | 'selector' => $this->selector( '-repeater__new' ), |
| 2410 | ) |
| 2411 | ); |
| 2412 | |
| 2413 | $this->add_responsive_control( |
| 2414 | 'booking_form_repeater_border_radius', |
| 2415 | array( |
| 2416 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2417 | 'type' => Controls_Manager::DIMENSIONS, |
| 2418 | 'size_units' => array( 'px', '%' ), |
| 2419 | 'selectors' => array( |
| 2420 | $this->selector( '-repeater__new' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2421 | ), |
| 2422 | ) |
| 2423 | ); |
| 2424 | |
| 2425 | $this->add_group_control( |
| 2426 | Group_Control_Box_Shadow::get_type(), |
| 2427 | array( |
| 2428 | 'name' => 'booking_form_repeater_box_shadow', |
| 2429 | 'selector' => $this->selector( '-repeater__new' ), |
| 2430 | ) |
| 2431 | ); |
| 2432 | |
| 2433 | $this->add_responsive_control( |
| 2434 | 'booking_form_repeater_alignment', |
| 2435 | array( |
| 2436 | 'label' => esc_html__( 'Alignment', 'jet-form-builder' ), |
| 2437 | 'type' => Controls_Manager::CHOOSE, |
| 2438 | 'options' => array( |
| 2439 | 'flex-start' => array( |
| 2440 | 'title' => esc_html__( 'Start', 'jet-form-builder' ), |
| 2441 | 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 2442 | ), |
| 2443 | 'center' => array( |
| 2444 | 'title' => esc_html__( 'Center', 'jet-form-builder' ), |
| 2445 | 'icon' => 'eicon-h-align-center', |
| 2446 | ), |
| 2447 | 'flex-end' => array( |
| 2448 | 'title' => esc_html__( 'End', 'jet-form-builder' ), |
| 2449 | 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 2450 | ), |
| 2451 | ), |
| 2452 | 'selectors' => array( |
| 2453 | $this->selector( '-repeater__actions' ) => 'justify-content: {{VALUE}};', |
| 2454 | ), |
| 2455 | ) |
| 2456 | ); |
| 2457 | |
| 2458 | $this->add_control( |
| 2459 | 'field_repeater_del_desc', |
| 2460 | array( |
| 2461 | 'label' => esc_html__( 'Remove item button', 'jet-form-builder' ), |
| 2462 | 'type' => Controls_Manager::HEADING, |
| 2463 | 'separator' => 'before', |
| 2464 | ) |
| 2465 | ); |
| 2466 | |
| 2467 | $this->start_controls_tabs( 'tabs_booking_form_repeater_del_style' ); |
| 2468 | |
| 2469 | $this->start_controls_tab( |
| 2470 | 'booking_form_repeater_del_normal', |
| 2471 | array( |
| 2472 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 2473 | ) |
| 2474 | ); |
| 2475 | |
| 2476 | $this->add_control( |
| 2477 | 'booking_form_repeater_del_bg_color', |
| 2478 | array( |
| 2479 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2480 | 'type' => Controls_Manager::COLOR, |
| 2481 | 'selectors' => array( |
| 2482 | $this->selector( '-repeater__remove' ) => 'background-color: {{VALUE}}', |
| 2483 | ), |
| 2484 | ) |
| 2485 | ); |
| 2486 | |
| 2487 | $this->add_control( |
| 2488 | 'booking_form_repeater_del_color', |
| 2489 | array( |
| 2490 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2491 | 'type' => Controls_Manager::COLOR, |
| 2492 | 'selectors' => array( |
| 2493 | $this->selector( '-repeater__remove' ) => 'color: {{VALUE}}', |
| 2494 | ), |
| 2495 | ) |
| 2496 | ); |
| 2497 | |
| 2498 | $this->end_controls_tab(); |
| 2499 | |
| 2500 | $this->start_controls_tab( |
| 2501 | 'booking_form_repeater_del_hover', |
| 2502 | array( |
| 2503 | 'label' => esc_html__( 'Hover', 'jet-form-builder' ), |
| 2504 | ) |
| 2505 | ); |
| 2506 | |
| 2507 | $this->add_control( |
| 2508 | 'booking_form_repeater_del_bg_color_hover', |
| 2509 | array( |
| 2510 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2511 | 'type' => Controls_Manager::COLOR, |
| 2512 | 'selectors' => array( |
| 2513 | $this->selector( '-repeater__remove:hover' ) => 'background-color: {{VALUE}}', |
| 2514 | ), |
| 2515 | ) |
| 2516 | ); |
| 2517 | |
| 2518 | $this->add_control( |
| 2519 | 'booking_form_repeater_del_color_hover', |
| 2520 | array( |
| 2521 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2522 | 'type' => Controls_Manager::COLOR, |
| 2523 | 'selectors' => array( |
| 2524 | $this->selector( '-repeater__remove:hover' ) => 'color: {{VALUE}}', |
| 2525 | ), |
| 2526 | ) |
| 2527 | ); |
| 2528 | |
| 2529 | $this->add_control( |
| 2530 | 'booking_form_repeater_del_hover_border_color', |
| 2531 | array( |
| 2532 | 'label' => esc_html__( 'Border Color', 'jet-form-builder' ), |
| 2533 | 'type' => Controls_Manager::COLOR, |
| 2534 | 'condition' => array( |
| 2535 | 'booking_form_repeater_del_border_border!' => '', |
| 2536 | ), |
| 2537 | 'selectors' => array( |
| 2538 | $this->selector( '-repeater__remove:hover' ) => 'border-color: {{VALUE}};', |
| 2539 | ), |
| 2540 | ) |
| 2541 | ); |
| 2542 | |
| 2543 | $this->end_controls_tab(); |
| 2544 | |
| 2545 | $this->end_controls_tabs(); |
| 2546 | |
| 2547 | $this->add_responsive_control( |
| 2548 | 'booking_form_repeater_del_padding', |
| 2549 | array( |
| 2550 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2551 | 'type' => Controls_Manager::DIMENSIONS, |
| 2552 | 'size_units' => array( 'px', '%', 'em' ), |
| 2553 | 'separator' => 'before', |
| 2554 | 'selectors' => array( |
| 2555 | $this->selector( '-repeater__remove' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2556 | ), |
| 2557 | ) |
| 2558 | ); |
| 2559 | |
| 2560 | $this->add_responsive_control( |
| 2561 | 'booking_form_repeater_del_margin', |
| 2562 | array( |
| 2563 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2564 | 'type' => Controls_Manager::DIMENSIONS, |
| 2565 | 'size_units' => array( 'px', '%', 'em' ), |
| 2566 | 'selectors' => array( |
| 2567 | $this->selector( '-repeater__remove' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2568 | ), |
| 2569 | ) |
| 2570 | ); |
| 2571 | |
| 2572 | $this->add_group_control( |
| 2573 | Group_Control_Border::get_type(), |
| 2574 | array( |
| 2575 | 'name' => 'booking_form_repeater_del_border', |
| 2576 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2577 | 'placeholder' => '1px', |
| 2578 | 'selector' => $this->selector( '-repeater__remove' ), |
| 2579 | ) |
| 2580 | ); |
| 2581 | |
| 2582 | $this->add_responsive_control( |
| 2583 | 'booking_form_repeater_del_border_radius', |
| 2584 | array( |
| 2585 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2586 | 'type' => Controls_Manager::DIMENSIONS, |
| 2587 | 'size_units' => array( 'px', '%' ), |
| 2588 | 'selectors' => array( |
| 2589 | $this->selector( '-repeater__remove' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2590 | ), |
| 2591 | ) |
| 2592 | ); |
| 2593 | |
| 2594 | $this->add_control( |
| 2595 | 'booking_form_repeater_del_size', |
| 2596 | array( |
| 2597 | 'label' => esc_html__( 'Icon Size', 'jet-form-builder' ), |
| 2598 | 'type' => Controls_Manager::SLIDER, |
| 2599 | 'size_units' => array( 'px' ), |
| 2600 | 'range' => array( |
| 2601 | 'px' => array( |
| 2602 | 'min' => 12, |
| 2603 | 'max' => 90, |
| 2604 | ), |
| 2605 | ), |
| 2606 | 'selectors' => array( |
| 2607 | $this->selector( '-repeater__remove' ) => 'font-size: {{SIZE}}{{UNIT}};line-height: {{SIZE}}{{UNIT}};', |
| 2608 | ), |
| 2609 | ) |
| 2610 | ); |
| 2611 | |
| 2612 | $this->add_group_control( |
| 2613 | Group_Control_Box_Shadow::get_type(), |
| 2614 | array( |
| 2615 | 'name' => 'booking_form_repeater_del_box_shadow', |
| 2616 | 'selector' => $this->selector( '-repeater__remove' ), |
| 2617 | ) |
| 2618 | ); |
| 2619 | |
| 2620 | $this->add_responsive_control( |
| 2621 | 'booking_form_repeater_del_alignment', |
| 2622 | array( |
| 2623 | 'label' => esc_html__( 'Alignment', 'jet-form-builder' ), |
| 2624 | 'type' => Controls_Manager::CHOOSE, |
| 2625 | 'default' => 'flex-start', |
| 2626 | 'options' => array( |
| 2627 | 'flex-start' => array( |
| 2628 | 'title' => esc_html__( 'Top', 'jet-form-builder' ), |
| 2629 | 'icon' => 'eicon-v-align-top', |
| 2630 | ), |
| 2631 | 'center' => array( |
| 2632 | 'title' => esc_html__( 'Middle', 'jet-form-builder' ), |
| 2633 | 'icon' => 'eicon-v-align-middle', |
| 2634 | ), |
| 2635 | 'flex-end' => array( |
| 2636 | 'title' => esc_html__( 'Bottom', 'jet-form-builder' ), |
| 2637 | 'icon' => 'eicon-v-align-bottom', |
| 2638 | ), |
| 2639 | ), |
| 2640 | 'selectors' => array( |
| 2641 | $this->selector( '-repeater__row-remove' ) => 'align-self: {{VALUE}};', |
| 2642 | ), |
| 2643 | ) |
| 2644 | ); |
| 2645 | |
| 2646 | $this->end_controls_section(); |
| 2647 | }; |
| 2648 | $closure(); |
| 2649 | |
| 2650 | /** Conditional block */ |
| 2651 | $closure = function () { |
| 2652 | $this->start_controls_section( |
| 2653 | 'conditional_style', |
| 2654 | array( |
| 2655 | 'label' => esc_html__( 'Conditional block', 'jet-form-builder' ), |
| 2656 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2657 | 'show_label' => false, |
| 2658 | ) |
| 2659 | ); |
| 2660 | |
| 2661 | $this->add_responsive_control( |
| 2662 | 'conditional_padding', |
| 2663 | array( |
| 2664 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2665 | 'type' => Controls_Manager::DIMENSIONS, |
| 2666 | 'size_units' => array( 'px', '%', 'em' ), |
| 2667 | 'selectors' => array( |
| 2668 | $this->selector( '__conditional' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2669 | ), |
| 2670 | ) |
| 2671 | ); |
| 2672 | |
| 2673 | $this->add_responsive_control( |
| 2674 | 'conditional_margin', |
| 2675 | array( |
| 2676 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2677 | 'type' => Controls_Manager::DIMENSIONS, |
| 2678 | 'size_units' => array( 'px', '%', 'em' ), |
| 2679 | 'selectors' => array( |
| 2680 | $this->selector( '__conditional' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2681 | ), |
| 2682 | ) |
| 2683 | ); |
| 2684 | |
| 2685 | $this->add_group_control( |
| 2686 | Group_Control_Border::get_type(), |
| 2687 | array( |
| 2688 | 'name' => 'conditional_border', |
| 2689 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2690 | 'placeholder' => '1px', |
| 2691 | 'selector' => $this->selector( '__conditional' ), |
| 2692 | ) |
| 2693 | ); |
| 2694 | |
| 2695 | $this->add_responsive_control( |
| 2696 | 'conditional_border_radius', |
| 2697 | array( |
| 2698 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2699 | 'type' => Controls_Manager::DIMENSIONS, |
| 2700 | 'size_units' => array( 'px', '%' ), |
| 2701 | 'selectors' => array( |
| 2702 | $this->selector( '__conditional' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2703 | ), |
| 2704 | ) |
| 2705 | ); |
| 2706 | |
| 2707 | $this->add_group_control( |
| 2708 | Group_Control_Box_Shadow::get_type(), |
| 2709 | array( |
| 2710 | 'name' => 'conditional_box_shadow', |
| 2711 | 'selector' => $this->selector( '__conditional' ), |
| 2712 | ) |
| 2713 | ); |
| 2714 | |
| 2715 | $this->add_control( |
| 2716 | 'conditional_bg_color', |
| 2717 | array( |
| 2718 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2719 | 'type' => Controls_Manager::COLOR, |
| 2720 | 'selectors' => array( |
| 2721 | $this->selector( '__conditional' ) => 'background-color: {{VALUE}}', |
| 2722 | ), |
| 2723 | ) |
| 2724 | ); |
| 2725 | |
| 2726 | $this->end_controls_section(); |
| 2727 | }; |
| 2728 | $closure(); |
| 2729 | |
| 2730 | /** Submit */ |
| 2731 | $closure = function () { |
| 2732 | $this->start_controls_section( |
| 2733 | 'form_submit_style', |
| 2734 | array( |
| 2735 | 'label' => esc_html__( 'Submit', 'jet-form-builder' ), |
| 2736 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2737 | 'show_label' => false, |
| 2738 | ) |
| 2739 | ); |
| 2740 | |
| 2741 | $this->start_controls_tabs( 'tabs_booking_form_submit_style' ); |
| 2742 | |
| 2743 | $this->start_controls_tab( |
| 2744 | 'booking_form_submit_normal', |
| 2745 | array( |
| 2746 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 2747 | ) |
| 2748 | ); |
| 2749 | |
| 2750 | $this->add_control( |
| 2751 | 'booking_form_submit_bg_color', |
| 2752 | array( |
| 2753 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2754 | 'type' => Controls_Manager::COLOR, |
| 2755 | 'selectors' => array( |
| 2756 | $this->selector( '__action-button' ) => 'background-color: {{VALUE}}', |
| 2757 | ), |
| 2758 | ) |
| 2759 | ); |
| 2760 | |
| 2761 | $this->add_control( |
| 2762 | 'booking_form_submit_color', |
| 2763 | array( |
| 2764 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2765 | 'type' => Controls_Manager::COLOR, |
| 2766 | 'selectors' => array( |
| 2767 | $this->selector( '__action-button' ) => 'color: {{VALUE}}', |
| 2768 | ), |
| 2769 | ) |
| 2770 | ); |
| 2771 | |
| 2772 | $this->end_controls_tab(); |
| 2773 | |
| 2774 | $this->start_controls_tab( |
| 2775 | 'booking_form_submit_hover', |
| 2776 | array( |
| 2777 | 'label' => esc_html__( 'Hover', 'jet-form-builder' ), |
| 2778 | ) |
| 2779 | ); |
| 2780 | |
| 2781 | $this->add_control( |
| 2782 | 'booking_form_submit_bg_color_hover', |
| 2783 | array( |
| 2784 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2785 | 'type' => Controls_Manager::COLOR, |
| 2786 | 'selectors' => array( |
| 2787 | $this->selector( '__action-button:hover' ) => 'background-color: {{VALUE}}', |
| 2788 | ), |
| 2789 | ) |
| 2790 | ); |
| 2791 | |
| 2792 | $this->add_control( |
| 2793 | 'booking_form_submit_color_hover', |
| 2794 | array( |
| 2795 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2796 | 'type' => Controls_Manager::COLOR, |
| 2797 | 'selectors' => array( |
| 2798 | $this->selector( '__action-button:hover' ) => 'color: {{VALUE}}', |
| 2799 | ), |
| 2800 | ) |
| 2801 | ); |
| 2802 | |
| 2803 | $this->add_control( |
| 2804 | 'booking_form_submit_hover_border_color', |
| 2805 | array( |
| 2806 | 'label' => esc_html__( 'Border Color', 'jet-form-builder' ), |
| 2807 | 'type' => Controls_Manager::COLOR, |
| 2808 | 'condition' => array( |
| 2809 | 'booking_form_submit_border_border!' => '', |
| 2810 | ), |
| 2811 | 'selectors' => array( |
| 2812 | $this->selector( '__action-button:hover' ) => 'border-color: {{VALUE}};', |
| 2813 | ), |
| 2814 | ) |
| 2815 | ); |
| 2816 | |
| 2817 | $this->end_controls_tab(); |
| 2818 | |
| 2819 | $this->end_controls_tabs(); |
| 2820 | |
| 2821 | $this->add_group_control( |
| 2822 | Group_Control_Typography::get_type(), |
| 2823 | array( |
| 2824 | 'name' => 'booking_form_submit_typography', |
| 2825 | 'selector' => $this->selector( '__action-button' ), |
| 2826 | 'fields_options' => array( |
| 2827 | 'typography' => array( |
| 2828 | 'separator' => 'after', |
| 2829 | ), |
| 2830 | ), |
| 2831 | ) |
| 2832 | ); |
| 2833 | |
| 2834 | $this->add_responsive_control( |
| 2835 | 'booking_form_submit_padding', |
| 2836 | array( |
| 2837 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2838 | 'type' => Controls_Manager::DIMENSIONS, |
| 2839 | 'size_units' => array( 'px', '%', 'em' ), |
| 2840 | 'selectors' => array( |
| 2841 | $this->selector( '__action-button' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2842 | ), |
| 2843 | ) |
| 2844 | ); |
| 2845 | |
| 2846 | $this->add_responsive_control( |
| 2847 | 'booking_form_submit_margin', |
| 2848 | array( |
| 2849 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2850 | 'type' => Controls_Manager::DIMENSIONS, |
| 2851 | 'size_units' => array( 'px', '%', 'em' ), |
| 2852 | 'selectors' => array( |
| 2853 | $this->selector( '__action-button' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2854 | ), |
| 2855 | ) |
| 2856 | ); |
| 2857 | |
| 2858 | $this->add_group_control( |
| 2859 | Group_Control_Border::get_type(), |
| 2860 | array( |
| 2861 | 'name' => 'booking_form_submit_border', |
| 2862 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2863 | 'placeholder' => '1px', |
| 2864 | 'selector' => $this->selector( '__action-button' ), |
| 2865 | ) |
| 2866 | ); |
| 2867 | |
| 2868 | $this->add_responsive_control( |
| 2869 | 'booking_form_submit_border_radius', |
| 2870 | array( |
| 2871 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2872 | 'type' => Controls_Manager::DIMENSIONS, |
| 2873 | 'size_units' => array( 'px', '%' ), |
| 2874 | 'selectors' => array( |
| 2875 | $this->selector( '__action-button' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2876 | ), |
| 2877 | ) |
| 2878 | ); |
| 2879 | |
| 2880 | $this->add_group_control( |
| 2881 | Group_Control_Box_Shadow::get_type(), |
| 2882 | array( |
| 2883 | 'name' => 'booking_form_submit_box_shadow', |
| 2884 | 'selector' => $this->selector( '__action-button' ), |
| 2885 | ) |
| 2886 | ); |
| 2887 | |
| 2888 | $this->add_responsive_control( |
| 2889 | 'booking_form_submit_alignment', |
| 2890 | array( |
| 2891 | 'label' => esc_html__( 'Alignment', 'jet-form-builder' ), |
| 2892 | 'type' => Controls_Manager::CHOOSE, |
| 2893 | 'options' => array( |
| 2894 | 'flex-start' => array( |
| 2895 | 'title' => esc_html__( 'Start', 'jet-form-builder' ), |
| 2896 | 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 2897 | ), |
| 2898 | 'center' => array( |
| 2899 | 'title' => esc_html__( 'Center', 'jet-form-builder' ), |
| 2900 | 'icon' => 'eicon-h-align-center', |
| 2901 | ), |
| 2902 | 'flex-end' => array( |
| 2903 | 'title' => esc_html__( 'End', 'jet-form-builder' ), |
| 2904 | 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 2905 | ), |
| 2906 | 'stretch' => array( |
| 2907 | 'title' => esc_html__( 'Fullwidth', 'jet-form-builder' ), |
| 2908 | 'icon' => 'eicon-h-align-stretch', |
| 2909 | ), |
| 2910 | ), |
| 2911 | 'selectors' => array( |
| 2912 | $this->selector( '__submit-wrap' ) => 'justify-content: {{VALUE}}; align-items: {{VALUE}};', |
| 2913 | ), |
| 2914 | ) |
| 2915 | ); |
| 2916 | |
| 2917 | $this->add_control( |
| 2918 | 'booking_form_submit_alignment_hidden', |
| 2919 | array( |
| 2920 | 'type' => Controls_Manager::HIDDEN, |
| 2921 | 'default' => 'style', |
| 2922 | 'selectors' => array( |
| 2923 | $this->selector( '__submit-wrap > .%s__submit' ) => 'width: 100%', |
| 2924 | ), |
| 2925 | 'condition' => array( |
| 2926 | 'booking_form_submit_alignment' => 'stretch', |
| 2927 | ), |
| 2928 | ) |
| 2929 | ); |
| 2930 | |
| 2931 | $this->add_responsive_control( |
| 2932 | 'booking_form_submit_alignment_text', |
| 2933 | array( |
| 2934 | 'label' => esc_html__( 'Button Text Alignment', 'jet-form-builder' ), |
| 2935 | 'type' => Controls_Manager::CHOOSE, |
| 2936 | 'options' => array( |
| 2937 | 'flex-start' => array( |
| 2938 | 'title' => esc_html__( 'Start', 'jet-form-builder' ), |
| 2939 | 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 2940 | ), |
| 2941 | 'center' => array( |
| 2942 | 'title' => esc_html__( 'Center', 'jet-form-builder' ), |
| 2943 | 'icon' => 'eicon-h-align-center', |
| 2944 | ), |
| 2945 | 'flex-end' => array( |
| 2946 | 'title' => esc_html__( 'End', 'jet-form-builder' ), |
| 2947 | 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 2948 | ), |
| 2949 | ), |
| 2950 | 'selectors' => array( |
| 2951 | $this->selector( '__submit' ) => 'justify-content: {{VALUE}};', |
| 2952 | ), |
| 2953 | ) |
| 2954 | ); |
| 2955 | |
| 2956 | $this->end_controls_section(); |
| 2957 | }; |
| 2958 | $closure(); |
| 2959 | |
| 2960 | /** Form Break Row */ |
| 2961 | $closure = function () { |
| 2962 | |
| 2963 | $this->start_controls_section( |
| 2964 | 'section_form_break_style', |
| 2965 | array( |
| 2966 | 'label' => __( 'Form Break Row', 'jet-form-builder' ), |
| 2967 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2968 | ) |
| 2969 | ); |
| 2970 | |
| 2971 | $this->add_responsive_control( |
| 2972 | 'form_break_gap', |
| 2973 | array( |
| 2974 | 'label' => __( 'Gap', 'jet-form-builder' ), |
| 2975 | 'type' => Controls_Manager::DIMENSIONS, |
| 2976 | 'size_units' => array( 'px' ), |
| 2977 | 'selectors' => array( |
| 2978 | $this->selector( '__next-page-wrap' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2979 | ), |
| 2980 | ) |
| 2981 | ); |
| 2982 | |
| 2983 | $this->add_responsive_control( |
| 2984 | 'form_break_alignment', |
| 2985 | array( |
| 2986 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 2987 | 'type' => Controls_Manager::CHOOSE, |
| 2988 | 'label_block' => false, |
| 2989 | 'default' => 'left', |
| 2990 | 'separator' => 'before', |
| 2991 | 'options' => array( |
| 2992 | 'left' => array( |
| 2993 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 2994 | 'icon' => 'eicon-h-align-left', |
| 2995 | ), |
| 2996 | 'center' => array( |
| 2997 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 2998 | 'icon' => 'eicon-h-align-center', |
| 2999 | ), |
| 3000 | 'right' => array( |
| 3001 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3002 | 'icon' => 'eicon-h-align-right', |
| 3003 | ), |
| 3004 | ), |
| 3005 | 'selectors' => array( |
| 3006 | $this->selector( '__next-page-wrap' ) => 'text-align: {{VALUE}};', |
| 3007 | ), |
| 3008 | ) |
| 3009 | ); |
| 3010 | |
| 3011 | $this->add_border( |
| 3012 | $this, |
| 3013 | 'form_break_border', |
| 3014 | $this->selector( '__next-page-wrap' ) |
| 3015 | ); |
| 3016 | |
| 3017 | $this->end_controls_section(); |
| 3018 | }; |
| 3019 | $closure(); |
| 3020 | |
| 3021 | /** Form Break Buttons */ |
| 3022 | $closure = function () { |
| 3023 | $this->start_controls_section( |
| 3024 | 'section_form_break_next_style', |
| 3025 | array( |
| 3026 | 'label' => __( 'Form Break Buttons', 'jet-form-builder' ), |
| 3027 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3028 | ) |
| 3029 | ); |
| 3030 | |
| 3031 | $this->add_control( |
| 3032 | 'form_break_next_button__error_heading', |
| 3033 | array( |
| 3034 | 'label' => __( 'Next Button', 'jet-form-builder' ), |
| 3035 | 'type' => Controls_Manager::HEADING, |
| 3036 | 'separator' => 'after', |
| 3037 | ) |
| 3038 | ); |
| 3039 | |
| 3040 | $this->add_responsive_control( |
| 3041 | 'form_break_next_margin', |
| 3042 | array( |
| 3043 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3044 | 'type' => Controls_Manager::DIMENSIONS, |
| 3045 | 'size_units' => array( 'px' ), |
| 3046 | 'selectors' => array( |
| 3047 | $this->selector( '__next-page' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3048 | ), |
| 3049 | ) |
| 3050 | ); |
| 3051 | |
| 3052 | $this->add_responsive_control( |
| 3053 | 'form_break_next_padding', |
| 3054 | array( |
| 3055 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3056 | 'type' => Controls_Manager::DIMENSIONS, |
| 3057 | 'size_units' => array( 'px' ), |
| 3058 | 'selectors' => array( |
| 3059 | $this->selector( '__next-page' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3060 | ), |
| 3061 | ) |
| 3062 | ); |
| 3063 | |
| 3064 | $this->add_responsive_control( |
| 3065 | 'form_break_next_justify', |
| 3066 | array( |
| 3067 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3068 | 'type' => Controls_Manager::CHOOSE, |
| 3069 | 'label_block' => false, |
| 3070 | 'options' => array( |
| 3071 | 'flex-start' => array( |
| 3072 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3073 | 'icon' => 'eicon-h-align-left', |
| 3074 | ), |
| 3075 | 'center' => array( |
| 3076 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3077 | 'icon' => 'eicon-h-align-center', |
| 3078 | ), |
| 3079 | 'flex-end' => array( |
| 3080 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3081 | 'icon' => 'eicon-h-align-right', |
| 3082 | ), |
| 3083 | ), |
| 3084 | 'selectors' => array( |
| 3085 | $this->selector( '-row .%s__action-button-wrapper[data-type="next"]' ) => 'justify-content: {{VALUE}};', |
| 3086 | ), |
| 3087 | ) |
| 3088 | ); |
| 3089 | |
| 3090 | $this->start_controls_tabs( 'form_break_next_styles' ); |
| 3091 | |
| 3092 | $this->start_controls_tab( |
| 3093 | 'form_break_next--normal', |
| 3094 | array( |
| 3095 | 'label' => __( 'Normal', 'jet-form-builder' ), |
| 3096 | ) |
| 3097 | ); |
| 3098 | |
| 3099 | $this->add_group_control( |
| 3100 | Group_Control_Typography::get_type(), |
| 3101 | array( |
| 3102 | 'name' => 'form_break_next_typography', |
| 3103 | 'selector' => $this->selector( '__next-page' ), |
| 3104 | ) |
| 3105 | ); |
| 3106 | |
| 3107 | $this->add_border( |
| 3108 | $this, |
| 3109 | 'form_break_next_border', |
| 3110 | $this->selector( '__next-page' ) |
| 3111 | ); |
| 3112 | |
| 3113 | $this->add_control( |
| 3114 | 'form_break_next_color--normal', |
| 3115 | array( |
| 3116 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3117 | 'type' => Controls_Manager::COLOR, |
| 3118 | 'selectors' => array( |
| 3119 | $this->selector( '__next-page' ) => 'color: {{VALUE}};', |
| 3120 | ), |
| 3121 | ) |
| 3122 | ); |
| 3123 | |
| 3124 | $this->add_control( |
| 3125 | 'form_break_next_bg_color--normal', |
| 3126 | array( |
| 3127 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3128 | 'type' => Controls_Manager::COLOR, |
| 3129 | 'selectors' => array( |
| 3130 | $this->selector( '__next-page' ) => 'background-color: {{VALUE}};', |
| 3131 | ), |
| 3132 | ) |
| 3133 | ); |
| 3134 | |
| 3135 | $this->end_controls_tab(); |
| 3136 | |
| 3137 | $this->start_controls_tab( |
| 3138 | 'form_break_next--hover', |
| 3139 | array( |
| 3140 | 'label' => __( 'Hover', 'jet-form-builder' ), |
| 3141 | ) |
| 3142 | ); |
| 3143 | |
| 3144 | $this->add_group_control( |
| 3145 | Group_Control_Typography::get_type(), |
| 3146 | array( |
| 3147 | 'name' => 'form_break_next_typography--hover', |
| 3148 | 'selector' => $this->selector( '__next-page:hover' ), |
| 3149 | ) |
| 3150 | ); |
| 3151 | |
| 3152 | $this->add_border( |
| 3153 | $this, |
| 3154 | 'form_break_next_border--hover', |
| 3155 | $this->selector( '__next-page:hover' ) |
| 3156 | ); |
| 3157 | |
| 3158 | $this->add_control( |
| 3159 | 'form_break_next_color--hover', |
| 3160 | array( |
| 3161 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3162 | 'type' => Controls_Manager::COLOR, |
| 3163 | 'selectors' => array( |
| 3164 | $this->selector( '__next-page:hover' ) => 'color: {{VALUE}};', |
| 3165 | ), |
| 3166 | ) |
| 3167 | ); |
| 3168 | $this->add_control( |
| 3169 | 'form_break_next_bg_color--hover', |
| 3170 | array( |
| 3171 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3172 | 'type' => Controls_Manager::COLOR, |
| 3173 | 'selectors' => array( |
| 3174 | $this->selector( '__next-page:hover' ) => 'background-color: {{VALUE}};', |
| 3175 | ), |
| 3176 | ) |
| 3177 | ); |
| 3178 | |
| 3179 | $this->end_controls_tab(); |
| 3180 | $this->end_controls_tabs(); |
| 3181 | |
| 3182 | $this->add_control( |
| 3183 | 'form_break_prev_button__error_heading', |
| 3184 | array( |
| 3185 | 'label' => __( 'Prev Button', 'jet-form-builder' ), |
| 3186 | 'type' => Controls_Manager::HEADING, |
| 3187 | 'separator' => 'before', |
| 3188 | ) |
| 3189 | ); |
| 3190 | |
| 3191 | $this->add_responsive_control( |
| 3192 | 'form_break_prev_margin', |
| 3193 | array( |
| 3194 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3195 | 'type' => Controls_Manager::DIMENSIONS, |
| 3196 | 'size_units' => array( 'px' ), |
| 3197 | 'selectors' => array( |
| 3198 | $this->selector( '__prev-page' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3199 | ), |
| 3200 | ) |
| 3201 | ); |
| 3202 | |
| 3203 | $this->add_responsive_control( |
| 3204 | 'form_break_prev_padding', |
| 3205 | array( |
| 3206 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3207 | 'type' => Controls_Manager::DIMENSIONS, |
| 3208 | 'size_units' => array( 'px' ), |
| 3209 | 'selectors' => array( |
| 3210 | $this->selector( '__prev-page' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3211 | ), |
| 3212 | ) |
| 3213 | ); |
| 3214 | |
| 3215 | $this->add_responsive_control( |
| 3216 | 'form_break_prev_justify', |
| 3217 | array( |
| 3218 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3219 | 'type' => Controls_Manager::CHOOSE, |
| 3220 | 'label_block' => false, |
| 3221 | 'options' => array( |
| 3222 | 'flex-start' => array( |
| 3223 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3224 | 'icon' => 'eicon-h-align-left', |
| 3225 | ), |
| 3226 | 'center' => array( |
| 3227 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3228 | 'icon' => 'eicon-h-align-center', |
| 3229 | ), |
| 3230 | 'flex-end' => array( |
| 3231 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3232 | 'icon' => 'eicon-h-align-right', |
| 3233 | ), |
| 3234 | ), |
| 3235 | 'selectors' => array( |
| 3236 | $this->selector( '-row .%s__action-button-wrapper[data-type="prev"]' ) => 'justify-content: {{VALUE}};', |
| 3237 | ), |
| 3238 | ) |
| 3239 | ); |
| 3240 | |
| 3241 | $this->start_controls_tabs( 'form_break_prev_styles' ); |
| 3242 | |
| 3243 | $this->start_controls_tab( |
| 3244 | 'form_break_prev--normal', |
| 3245 | array( |
| 3246 | 'label' => __( 'Normal', 'jet-form-builder' ), |
| 3247 | ) |
| 3248 | ); |
| 3249 | |
| 3250 | $this->add_group_control( |
| 3251 | Group_Control_Typography::get_type(), |
| 3252 | array( |
| 3253 | 'name' => 'form_break_prev_typography', |
| 3254 | 'selector' => $this->selector( '__prev-page' ), |
| 3255 | ) |
| 3256 | ); |
| 3257 | |
| 3258 | $this->add_border( |
| 3259 | $this, |
| 3260 | 'form_break_prev_border', |
| 3261 | $this->selector( '__prev-page' ) |
| 3262 | ); |
| 3263 | |
| 3264 | $this->add_control( |
| 3265 | 'form_break_prev_color--normal', |
| 3266 | array( |
| 3267 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3268 | 'type' => Controls_Manager::COLOR, |
| 3269 | 'selectors' => array( |
| 3270 | $this->selector( '__prev-page' ) => 'color: {{VALUE}};', |
| 3271 | ), |
| 3272 | ) |
| 3273 | ); |
| 3274 | |
| 3275 | $this->add_control( |
| 3276 | 'form_break_prev_bg_color--normal', |
| 3277 | array( |
| 3278 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3279 | 'type' => Controls_Manager::COLOR, |
| 3280 | 'selectors' => array( |
| 3281 | $this->selector( '__prev-page' ) => 'background-color: {{VALUE}};', |
| 3282 | ), |
| 3283 | ) |
| 3284 | ); |
| 3285 | |
| 3286 | $this->end_controls_tab(); |
| 3287 | |
| 3288 | $this->start_controls_tab( |
| 3289 | 'form_break_prev--hover', |
| 3290 | array( |
| 3291 | 'label' => __( 'Hover', 'jet-form-builder' ), |
| 3292 | ) |
| 3293 | ); |
| 3294 | |
| 3295 | $this->add_group_control( |
| 3296 | Group_Control_Typography::get_type(), |
| 3297 | array( |
| 3298 | 'name' => 'form_break_prev_typography--hover', |
| 3299 | 'selector' => $this->selector( '__prev-page:hover' ), |
| 3300 | ) |
| 3301 | ); |
| 3302 | |
| 3303 | $this->add_border( |
| 3304 | $this, |
| 3305 | 'form_break_prev_border--hover', |
| 3306 | $this->selector( '__prev-page:hover' ) |
| 3307 | ); |
| 3308 | |
| 3309 | $this->add_control( |
| 3310 | 'form_break_prev_color--hover', |
| 3311 | array( |
| 3312 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3313 | 'type' => Controls_Manager::COLOR, |
| 3314 | 'selectors' => array( |
| 3315 | $this->selector( '__prev-page:hover' ) => 'color: {{VALUE}};', |
| 3316 | ), |
| 3317 | ) |
| 3318 | ); |
| 3319 | $this->add_control( |
| 3320 | 'form_break_prev_bg_color--hover', |
| 3321 | array( |
| 3322 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3323 | 'type' => Controls_Manager::COLOR, |
| 3324 | 'selectors' => array( |
| 3325 | $this->selector( '__prev-page:hover' ) => 'background-color: {{VALUE}};', |
| 3326 | ), |
| 3327 | ) |
| 3328 | ); |
| 3329 | |
| 3330 | $this->end_controls_tab(); |
| 3331 | $this->end_controls_tabs(); |
| 3332 | |
| 3333 | $this->end_controls_section(); |
| 3334 | }; |
| 3335 | $closure(); |
| 3336 | |
| 3337 | /** Form Break Disabled Message */ |
| 3338 | $closure = function () { |
| 3339 | $this->start_controls_section( |
| 3340 | 'section_form_break_disabled_style', |
| 3341 | array( |
| 3342 | 'label' => __( 'Form Break Disabled Message', 'jet-form-builder' ), |
| 3343 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3344 | ) |
| 3345 | ); |
| 3346 | |
| 3347 | $this->add_responsive_control( |
| 3348 | 'form_break_disabled_margin', |
| 3349 | array( |
| 3350 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3351 | 'type' => Controls_Manager::DIMENSIONS, |
| 3352 | 'size_units' => array( 'px' ), |
| 3353 | 'selectors' => array( |
| 3354 | $this->selector( '__next-page-msg' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3355 | ), |
| 3356 | ) |
| 3357 | ); |
| 3358 | |
| 3359 | $this->add_responsive_control( |
| 3360 | 'form_break_disabled_padding', |
| 3361 | array( |
| 3362 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3363 | 'type' => Controls_Manager::DIMENSIONS, |
| 3364 | 'size_units' => array( 'px' ), |
| 3365 | 'selectors' => array( |
| 3366 | $this->selector( '__next-page-msg' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3367 | ), |
| 3368 | ) |
| 3369 | ); |
| 3370 | |
| 3371 | $this->add_group_control( |
| 3372 | Group_Control_Typography::get_type(), |
| 3373 | array( |
| 3374 | 'name' => 'form_break_disabled_typography', |
| 3375 | 'selector' => $this->selector( '__next-page-msg' ), |
| 3376 | ) |
| 3377 | ); |
| 3378 | |
| 3379 | $this->add_border( |
| 3380 | $this, |
| 3381 | 'form_break_disabled_border', |
| 3382 | $this->selector( '__next-page-msg' ) |
| 3383 | ); |
| 3384 | |
| 3385 | $this->end_controls_section(); |
| 3386 | }; |
| 3387 | $closure(); |
| 3388 | |
| 3389 | $this->run_form_progress_controls( |
| 3390 | $this, |
| 3391 | array( $this, 'selector' ), |
| 3392 | function ( $args ) { |
| 3393 | return $args; |
| 3394 | } |
| 3395 | ); |
| 3396 | |
| 3397 | /** Messages */ |
| 3398 | $closure = function () { |
| 3399 | $this->start_controls_section( |
| 3400 | 'section_message_error_style', |
| 3401 | array( |
| 3402 | 'label' => __( 'Messages', 'jet-form-builder' ), |
| 3403 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3404 | ) |
| 3405 | ); |
| 3406 | |
| 3407 | $this->start_controls_tabs( 'section_messages_tabs' ); |
| 3408 | |
| 3409 | $this->start_controls_tab( |
| 3410 | 'messages_success_tab', |
| 3411 | array( |
| 3412 | 'label' => __( 'Success Message', 'jet-form-builder' ), |
| 3413 | ) |
| 3414 | ); |
| 3415 | |
| 3416 | $this->add_responsive_control( |
| 3417 | 'form_success_margin', |
| 3418 | array( |
| 3419 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3420 | 'type' => Controls_Manager::DIMENSIONS, |
| 3421 | 'size_units' => array( 'px' ), |
| 3422 | 'selectors' => array( |
| 3423 | $this->selector( '-message--success' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3424 | ), |
| 3425 | ) |
| 3426 | ); |
| 3427 | |
| 3428 | $this->add_responsive_control( |
| 3429 | 'form_success_padding', |
| 3430 | array( |
| 3431 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3432 | 'type' => Controls_Manager::DIMENSIONS, |
| 3433 | 'size_units' => array( 'px' ), |
| 3434 | 'selectors' => array( |
| 3435 | $this->selector( '-message--success' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3436 | ), |
| 3437 | ) |
| 3438 | ); |
| 3439 | |
| 3440 | $this->add_responsive_control( |
| 3441 | 'form_success_alignment', |
| 3442 | array( |
| 3443 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3444 | 'type' => Controls_Manager::CHOOSE, |
| 3445 | 'label_block' => false, |
| 3446 | 'default' => 'center', |
| 3447 | 'separator' => 'before', |
| 3448 | 'options' => array( |
| 3449 | 'left' => array( |
| 3450 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3451 | 'icon' => 'eicon-h-align-left', |
| 3452 | ), |
| 3453 | 'center' => array( |
| 3454 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3455 | 'icon' => 'eicon-h-align-center', |
| 3456 | ), |
| 3457 | 'right' => array( |
| 3458 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3459 | 'icon' => 'eicon-h-align-right', |
| 3460 | ), |
| 3461 | ), |
| 3462 | 'selectors' => array( |
| 3463 | $this->selector( '-message--success' ) => 'text-align: {{VALUE}};', |
| 3464 | ), |
| 3465 | ) |
| 3466 | ); |
| 3467 | |
| 3468 | $this->add_group_control( |
| 3469 | Group_Control_Typography::get_type(), |
| 3470 | array( |
| 3471 | 'name' => 'form_success_typography', |
| 3472 | 'selector' => $this->selector( '-message--success' ), |
| 3473 | ) |
| 3474 | ); |
| 3475 | |
| 3476 | $this->add_control( |
| 3477 | 'form_success_color', |
| 3478 | array( |
| 3479 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3480 | 'type' => Controls_Manager::COLOR, |
| 3481 | 'selectors' => array( |
| 3482 | $this->selector( '-message--success' ) => 'color: {{VALUE}};', |
| 3483 | ), |
| 3484 | ) |
| 3485 | ); |
| 3486 | $this->add_control( |
| 3487 | 'form_success_bg_color', |
| 3488 | array( |
| 3489 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3490 | 'type' => Controls_Manager::COLOR, |
| 3491 | 'selectors' => array( |
| 3492 | $this->selector( '-message--success' ) => 'background-color: {{VALUE}};', |
| 3493 | ), |
| 3494 | ) |
| 3495 | ); |
| 3496 | |
| 3497 | $this->add_border( |
| 3498 | $this, |
| 3499 | 'form_success_border', |
| 3500 | $this->selector( '-message--success' ) |
| 3501 | ); |
| 3502 | |
| 3503 | $this->end_controls_tab(); |
| 3504 | |
| 3505 | $this->start_controls_tab( |
| 3506 | 'messages_error_tab', |
| 3507 | array( |
| 3508 | 'label' => __( 'Error Message', 'jet-form-builder' ), |
| 3509 | ) |
| 3510 | ); |
| 3511 | |
| 3512 | $this->add_responsive_control( |
| 3513 | 'form_error_margin', |
| 3514 | array( |
| 3515 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3516 | 'type' => Controls_Manager::DIMENSIONS, |
| 3517 | 'size_units' => array( 'px' ), |
| 3518 | 'selectors' => array( |
| 3519 | $this->selector( '-message--error' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3520 | ), |
| 3521 | ) |
| 3522 | ); |
| 3523 | |
| 3524 | $this->add_responsive_control( |
| 3525 | 'form_error_padding', |
| 3526 | array( |
| 3527 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3528 | 'type' => Controls_Manager::DIMENSIONS, |
| 3529 | 'size_units' => array( 'px' ), |
| 3530 | 'selectors' => array( |
| 3531 | $this->selector( '-message--error' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3532 | ), |
| 3533 | ) |
| 3534 | ); |
| 3535 | |
| 3536 | $this->add_responsive_control( |
| 3537 | 'form_error_alignment', |
| 3538 | array( |
| 3539 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3540 | 'type' => Controls_Manager::CHOOSE, |
| 3541 | 'label_block' => false, |
| 3542 | 'default' => 'center', |
| 3543 | 'separator' => 'before', |
| 3544 | 'options' => array( |
| 3545 | 'left' => array( |
| 3546 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3547 | 'icon' => 'eicon-h-align-left', |
| 3548 | ), |
| 3549 | 'center' => array( |
| 3550 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3551 | 'icon' => 'eicon-h-align-center', |
| 3552 | ), |
| 3553 | 'right' => array( |
| 3554 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3555 | 'icon' => 'eicon-h-align-right', |
| 3556 | ), |
| 3557 | ), |
| 3558 | 'selectors' => array( |
| 3559 | $this->selector( '-message--error' ) => 'text-align: {{VALUE}};', |
| 3560 | ), |
| 3561 | ) |
| 3562 | ); |
| 3563 | |
| 3564 | $this->add_group_control( |
| 3565 | Group_Control_Typography::get_type(), |
| 3566 | array( |
| 3567 | 'name' => 'form_error_typography', |
| 3568 | 'selector' => $this->selector( '-message--error' ), |
| 3569 | ) |
| 3570 | ); |
| 3571 | |
| 3572 | $this->add_control( |
| 3573 | 'form_error_color', |
| 3574 | array( |
| 3575 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3576 | 'type' => Controls_Manager::COLOR, |
| 3577 | 'selectors' => array( |
| 3578 | $this->selector( '-message--error' ) => 'color: {{VALUE}};', |
| 3579 | ), |
| 3580 | ) |
| 3581 | ); |
| 3582 | $this->add_control( |
| 3583 | 'form_error_bg_color', |
| 3584 | array( |
| 3585 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3586 | 'type' => Controls_Manager::COLOR, |
| 3587 | 'selectors' => array( |
| 3588 | $this->selector( '-message--error' ) => 'background-color: {{VALUE}};', |
| 3589 | ), |
| 3590 | ) |
| 3591 | ); |
| 3592 | |
| 3593 | $this->add_border( |
| 3594 | $this, |
| 3595 | 'form_error_border', |
| 3596 | $this->selector( '-message--error' ) |
| 3597 | ); |
| 3598 | |
| 3599 | $this->end_controls_tab(); |
| 3600 | $this->end_controls_tabs(); |
| 3601 | $this->end_controls_section(); |
| 3602 | }; |
| 3603 | $closure(); |
| 3604 | } |
| 3605 | |
| 3606 | private function add_border( $instance, $control_id, $selector ) { |
| 3607 | $instance->add_group_control( |
| 3608 | Group_Control_Border::get_type(), |
| 3609 | array( |
| 3610 | 'name' => $control_id, |
| 3611 | 'label' => __( 'Border', 'jet-form-builder' ), |
| 3612 | 'placeholder' => '1px', |
| 3613 | 'selector' => $selector, |
| 3614 | ) |
| 3615 | ); |
| 3616 | $instance->add_responsive_control( |
| 3617 | $control_id . '_radius', |
| 3618 | array( |
| 3619 | 'label' => __( 'Border Radius', 'jet-form-builder' ), |
| 3620 | 'type' => Controls_Manager::DIMENSIONS, |
| 3621 | 'size_units' => array( 'px', '%' ), |
| 3622 | 'selectors' => array( |
| 3623 | $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3624 | ), |
| 3625 | ) |
| 3626 | ); |
| 3627 | } |
| 3628 | |
| 3629 | /** |
| 3630 | * Render the widget output on the frontend. |
| 3631 | * |
| 3632 | * Written in PHP and used to generate the final HTML. |
| 3633 | * |
| 3634 | * @since 1.1.0 |
| 3635 | * |
| 3636 | * @access protected |
| 3637 | */ |
| 3638 | protected function render() { |
| 3639 | wp_print_styles( 'wp-block-library' ); |
| 3640 | $settings = $this->get_settings_for_display(); |
| 3641 | |
| 3642 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 3643 | echo jet_fb_render_form( $settings ); |
| 3644 | } |
| 3645 | |
| 3646 | |
| 3647 | } |
| 3648 |