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