form.php
3632 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->end_controls_section(); |
| 1718 | }; |
| 1719 | $closure(); |
| 1720 | |
| 1721 | /** Calculated Fields */ |
| 1722 | $closure = function () { |
| 1723 | $this->start_controls_section( |
| 1724 | 'section_calc_fields_style', |
| 1725 | array( |
| 1726 | 'label' => __( 'Calculated Fields', 'jet-form-builder' ), |
| 1727 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1728 | 'show_label' => false, |
| 1729 | ) |
| 1730 | ); |
| 1731 | |
| 1732 | $this->add_group_control( |
| 1733 | Group_Control_Typography::get_type(), |
| 1734 | array( |
| 1735 | 'name' => 'calc_fields_typography', |
| 1736 | 'selector' => $this->selector( '__calculated-field' ), |
| 1737 | ) |
| 1738 | ); |
| 1739 | |
| 1740 | $this->add_control( |
| 1741 | 'calc_fields_color', |
| 1742 | array( |
| 1743 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 1744 | 'type' => Controls_Manager::COLOR, |
| 1745 | 'selectors' => array( |
| 1746 | $this->selector( '__calculated-field' ) => 'color: {{VALUE}}', |
| 1747 | ), |
| 1748 | ) |
| 1749 | ); |
| 1750 | |
| 1751 | $this->add_control( |
| 1752 | 'calc_fields_prefix_color', |
| 1753 | array( |
| 1754 | 'label' => __( 'Prefix Color', 'jet-form-builder' ), |
| 1755 | 'type' => Controls_Manager::COLOR, |
| 1756 | 'selectors' => array( |
| 1757 | $this->selector( '__calculated-field-prefix' ) => 'color: {{VALUE}}', |
| 1758 | ), |
| 1759 | ) |
| 1760 | ); |
| 1761 | |
| 1762 | $this->add_responsive_control( |
| 1763 | 'calc_fields_prefix_size', |
| 1764 | array( |
| 1765 | 'label' => __( 'Prefix size', 'jet-form-builder' ), |
| 1766 | 'type' => Controls_Manager::SLIDER, |
| 1767 | 'size_units' => array( 'px' ), |
| 1768 | 'range' => array( |
| 1769 | 'px' => array( |
| 1770 | 'min' => 10, |
| 1771 | 'max' => 50, |
| 1772 | ), |
| 1773 | ), |
| 1774 | 'selectors' => array( |
| 1775 | $this->selector( '__calculated-field-prefix' ) => 'font-size: {{SIZE}}px;', |
| 1776 | ), |
| 1777 | ) |
| 1778 | ); |
| 1779 | |
| 1780 | $this->add_control( |
| 1781 | 'calc_fields_suffix_color', |
| 1782 | array( |
| 1783 | 'label' => __( 'Suffix Color', 'jet-form-builder' ), |
| 1784 | 'type' => Controls_Manager::COLOR, |
| 1785 | 'selectors' => array( |
| 1786 | $this->selector( '__calculated-field-suffix' ) => 'color: {{VALUE}}', |
| 1787 | ), |
| 1788 | ) |
| 1789 | ); |
| 1790 | |
| 1791 | $this->add_responsive_control( |
| 1792 | 'calc_fields_suffix_size', |
| 1793 | array( |
| 1794 | 'label' => __( 'Suffix size', 'jet-form-builder' ), |
| 1795 | 'type' => Controls_Manager::SLIDER, |
| 1796 | 'size_units' => array( 'px' ), |
| 1797 | 'range' => array( |
| 1798 | 'px' => array( |
| 1799 | 'min' => 10, |
| 1800 | 'max' => 50, |
| 1801 | ), |
| 1802 | ), |
| 1803 | 'selectors' => array( |
| 1804 | $this->selector( '__calculated-field-suffix' ) => 'font-size: {{SIZE}}px;', |
| 1805 | ), |
| 1806 | ) |
| 1807 | ); |
| 1808 | |
| 1809 | $this->add_control( |
| 1810 | 'calc_fields_background_color', |
| 1811 | array( |
| 1812 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 1813 | 'type' => Controls_Manager::COLOR, |
| 1814 | 'selectors' => array( |
| 1815 | $this->selector( '__calculated-field' ) => 'background-color: {{VALUE}}', |
| 1816 | ), |
| 1817 | ) |
| 1818 | ); |
| 1819 | |
| 1820 | $this->add_responsive_control( |
| 1821 | 'calc_fields_padding', |
| 1822 | array( |
| 1823 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 1824 | 'type' => Controls_Manager::DIMENSIONS, |
| 1825 | 'size_units' => array( 'px' ), |
| 1826 | 'selectors' => array( |
| 1827 | $this->selector( '__calculated-field' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1828 | ), |
| 1829 | ) |
| 1830 | ); |
| 1831 | |
| 1832 | $this->add_responsive_control( |
| 1833 | 'calc_fields_margin', |
| 1834 | array( |
| 1835 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 1836 | 'type' => Controls_Manager::DIMENSIONS, |
| 1837 | 'size_units' => array( 'px' ), |
| 1838 | 'selectors' => array( |
| 1839 | $this->selector( '__calculated-field' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1840 | ), |
| 1841 | ) |
| 1842 | ); |
| 1843 | |
| 1844 | $this->add_group_control( |
| 1845 | Group_Control_Border::get_type(), |
| 1846 | array( |
| 1847 | 'name' => 'calc_fields_border', |
| 1848 | 'label' => __( 'Border', 'jet-form-builder' ), |
| 1849 | 'placeholder' => '1px', |
| 1850 | 'selector' => $this->selector( '__calculated-field' ), |
| 1851 | ) |
| 1852 | ); |
| 1853 | |
| 1854 | $this->add_responsive_control( |
| 1855 | 'calc_fields_border_radius', |
| 1856 | array( |
| 1857 | 'label' => __( 'Border Radius', 'jet-form-builder' ), |
| 1858 | 'type' => Controls_Manager::DIMENSIONS, |
| 1859 | 'size_units' => array( 'px', '%' ), |
| 1860 | 'selectors' => array( |
| 1861 | $this->selector( '__calculated-field' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1862 | ), |
| 1863 | ) |
| 1864 | ); |
| 1865 | |
| 1866 | $this->add_responsive_control( |
| 1867 | 'calc_fields_flex_align', |
| 1868 | array( |
| 1869 | 'label' => __( 'Content Align', 'jet-form-builder' ), |
| 1870 | 'type' => Controls_Manager::SELECT, |
| 1871 | 'options' => array( |
| 1872 | '' => __( 'Default', 'jet-form-builder' ), |
| 1873 | 'start' => __( 'Left', 'jet-form-builder' ), |
| 1874 | 'center' => __( 'Center', 'jet-form-builder' ), |
| 1875 | 'end' => __( 'Right', 'jet-form-builder' ), |
| 1876 | 'space-between' => __( 'Space Between', 'jet-form-builder' ), |
| 1877 | 'space-evenly' => __( 'Space Evenly', 'jet-form-builder' ), |
| 1878 | 'space-around' => __( 'Space Around', 'jet-form-builder' ), |
| 1879 | ), |
| 1880 | 'selectors' => array( |
| 1881 | $this->selector( '__calculated-field' ) => 'justify-content: {{VALUE}};', |
| 1882 | ), |
| 1883 | ) |
| 1884 | ); |
| 1885 | |
| 1886 | $this->end_controls_section(); |
| 1887 | }; |
| 1888 | $closure(); |
| 1889 | |
| 1890 | /** Range Fields */ |
| 1891 | $closure = function () { |
| 1892 | $this->start_controls_section( |
| 1893 | 'section_range_fields_style', |
| 1894 | array( |
| 1895 | 'label' => __( 'Range Fields', 'jet-form-builder' ), |
| 1896 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1897 | ) |
| 1898 | ); |
| 1899 | |
| 1900 | $this->add_control( |
| 1901 | 'range_max_width', |
| 1902 | array( |
| 1903 | 'label' => esc_html__( 'Max Width', 'jet-form-builder' ), |
| 1904 | 'type' => Controls_Manager::SLIDER, |
| 1905 | 'size_units' => array( 'px', '%' ), |
| 1906 | 'range' => array( |
| 1907 | 'px' => array( |
| 1908 | 'min' => 1, |
| 1909 | 'max' => 1000, |
| 1910 | ), |
| 1911 | ), |
| 1912 | 'selectors' => array( |
| 1913 | $this->selector( '__field-wrap.range-wrap' ) => 'max-width: {{SIZE}}{{UNIT}};', |
| 1914 | ), |
| 1915 | ) |
| 1916 | ); |
| 1917 | |
| 1918 | $this->add_control( |
| 1919 | 'range_slider_heading', |
| 1920 | array( |
| 1921 | 'label' => esc_html__( 'Slider', 'jet-form-builder' ), |
| 1922 | 'type' => Controls_Manager::HEADING, |
| 1923 | 'separator' => 'before', |
| 1924 | ) |
| 1925 | ); |
| 1926 | |
| 1927 | $this->add_control( |
| 1928 | 'track_height', |
| 1929 | array( |
| 1930 | 'label' => esc_html__( 'Track Height', 'jet-form-builder' ), |
| 1931 | 'type' => Controls_Manager::SLIDER, |
| 1932 | 'size_units' => array( 'px' ), |
| 1933 | 'range' => array( |
| 1934 | 'px' => array( |
| 1935 | 'min' => 1, |
| 1936 | 'max' => 20, |
| 1937 | ), |
| 1938 | ), |
| 1939 | 'selectors' => array( |
| 1940 | $this->selector( ' .range-field::-webkit-slider-runnable-track' ) => 'height: {{SIZE}}{{UNIT}};', |
| 1941 | $this->selector( ' .range-field::-moz-range-track' ) => 'height: {{SIZE}}{{UNIT}};', |
| 1942 | $this->selector( ' .range-field::-ms-track' ) => 'height: {{SIZE}}{{UNIT}};', |
| 1943 | $this->selector( ' .range-field::-webkit-slider-thumb' ) => 'margin-top: calc( (18px - {{SIZE}}{{UNIT}})/-2 )', |
| 1944 | ), |
| 1945 | ) |
| 1946 | ); |
| 1947 | |
| 1948 | $this->add_control( |
| 1949 | 'thumb_size', |
| 1950 | array( |
| 1951 | 'label' => esc_html__( 'Thumb Size', 'jet-form-builder' ), |
| 1952 | 'type' => Controls_Manager::SLIDER, |
| 1953 | 'size_units' => array( 'px' ), |
| 1954 | 'range' => array( |
| 1955 | 'px' => array( |
| 1956 | 'min' => 1, |
| 1957 | 'max' => 50, |
| 1958 | ), |
| 1959 | ), |
| 1960 | 'selectors' => array( |
| 1961 | $this->selector( '__field.range-field' ) => 'min-height: {{SIZE}}{{UNIT}};', |
| 1962 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; margin-top: calc( ({{SIZE}}{{UNIT}} - 4px)/-2 )', |
| 1963 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1964 | $this->selector( '__field.range-field::-ms-thumb' ) => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1965 | ), |
| 1966 | ) |
| 1967 | ); |
| 1968 | |
| 1969 | $this->add_control( |
| 1970 | 'thumb_indent', |
| 1971 | array( |
| 1972 | 'type' => Controls_Manager::HIDDEN, |
| 1973 | 'default' => 'style', |
| 1974 | 'selectors' => array( |
| 1975 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'margin-top: calc( ({{thumb_size.SIZE}}{{thumb_size.UNIT}} - {{track_height.SIZE}}{{track_height.UNIT}})/-2 )', |
| 1976 | ), |
| 1977 | ) |
| 1978 | ); |
| 1979 | |
| 1980 | $this->add_control( |
| 1981 | 'track_border_radius', |
| 1982 | array( |
| 1983 | 'label' => esc_html__( 'Track Border Radius', 'jet-form-builder' ), |
| 1984 | 'type' => Controls_Manager::DIMENSIONS, |
| 1985 | 'size_units' => array( 'px', '%' ), |
| 1986 | 'selectors' => array( |
| 1987 | $this->selector( '__field.range-field::-webkit-slider-runnable-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1988 | $this->selector( '__field.range-field::-moz-range-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1989 | $this->selector( '__field.range-field::-ms-track' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1990 | ), |
| 1991 | ) |
| 1992 | ); |
| 1993 | |
| 1994 | $this->add_control( |
| 1995 | 'thumb_border_radius', |
| 1996 | array( |
| 1997 | 'label' => esc_html__( 'Thumb Border Radius', 'jet-form-builder' ), |
| 1998 | 'type' => Controls_Manager::DIMENSIONS, |
| 1999 | 'size_units' => array( 'px', '%' ), |
| 2000 | 'selectors' => array( |
| 2001 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2002 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2003 | $this->selector( '__field.range-field::-ms-thumb' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2004 | ), |
| 2005 | ) |
| 2006 | ); |
| 2007 | |
| 2008 | $this->add_control( |
| 2009 | 'track_bg_color', |
| 2010 | array( |
| 2011 | 'label' => esc_html__( 'Track Color', 'jet-form-builder' ), |
| 2012 | 'type' => Controls_Manager::COLOR, |
| 2013 | 'selectors' => array( |
| 2014 | $this->selector( '__field.range-field::-webkit-slider-runnable-track' ) => 'background-color: {{VALUE}};', |
| 2015 | $this->selector( '__field.range-field::-moz-range-track' ) => 'background-color: {{VALUE}};', |
| 2016 | $this->selector( '__field.range-field::-ms-track' ) => 'background-color: {{VALUE}};', |
| 2017 | ), |
| 2018 | ) |
| 2019 | ); |
| 2020 | |
| 2021 | $this->add_control( |
| 2022 | 'thumb_bg_color', |
| 2023 | array( |
| 2024 | 'label' => esc_html__( 'Thumb Color', 'jet-form-builder' ), |
| 2025 | 'type' => Controls_Manager::COLOR, |
| 2026 | 'selectors' => array( |
| 2027 | $this->selector( '__field.range-field::-webkit-slider-thumb' ) => 'background-color: {{VALUE}};', |
| 2028 | $this->selector( '__field.range-field::-moz-range-thumb' ) => 'background-color: {{VALUE}};', |
| 2029 | $this->selector( '__field.range-field::-ms-thumb' ) => 'background-color: {{VALUE}};', |
| 2030 | ), |
| 2031 | ) |
| 2032 | ); |
| 2033 | |
| 2034 | $this->add_control( |
| 2035 | 'range_value_heading', |
| 2036 | array( |
| 2037 | 'label' => esc_html__( 'Value', 'jet-form-builder' ), |
| 2038 | 'type' => Controls_Manager::HEADING, |
| 2039 | 'separator' => 'before', |
| 2040 | ) |
| 2041 | ); |
| 2042 | |
| 2043 | $this->add_group_control( |
| 2044 | Group_Control_Typography::get_type(), |
| 2045 | array( |
| 2046 | 'name' => 'range_value_typography', |
| 2047 | 'selector' => $this->selector( '__field-value.range-value' ), |
| 2048 | ) |
| 2049 | ); |
| 2050 | |
| 2051 | $this->add_control( |
| 2052 | 'range_value_color', |
| 2053 | array( |
| 2054 | 'label' => esc_html__( 'Color', 'jet-form-builder' ), |
| 2055 | 'type' => Controls_Manager::COLOR, |
| 2056 | 'selectors' => array( |
| 2057 | $this->selector( '__field-value.range-value' ) => 'color: {{VALUE}};', |
| 2058 | ), |
| 2059 | ) |
| 2060 | ); |
| 2061 | |
| 2062 | $this->add_responsive_control( |
| 2063 | 'range_prefix_value_size', |
| 2064 | array( |
| 2065 | 'label' => __( 'Prefix size', 'jet-form-builder' ), |
| 2066 | 'type' => Controls_Manager::SLIDER, |
| 2067 | 'size_units' => array( 'px', 'em', 'rem' ), |
| 2068 | 'range' => array( |
| 2069 | 'px' => array( |
| 2070 | 'min' => 10, |
| 2071 | 'max' => 50, |
| 2072 | ), |
| 2073 | ), |
| 2074 | 'selectors' => array( |
| 2075 | $this->selector( '__field-value.range-value .%s__field-value-prefix' ) => 'font-size: {{SIZE}}px;', |
| 2076 | ), |
| 2077 | 'separator' => 'before', |
| 2078 | ) |
| 2079 | ); |
| 2080 | |
| 2081 | $this->add_control( |
| 2082 | 'range_prefix_value_color', |
| 2083 | array( |
| 2084 | 'label' => __( 'Prefix Color', 'jet-form-builder' ), |
| 2085 | 'type' => Controls_Manager::COLOR, |
| 2086 | 'selectors' => array( |
| 2087 | $this->selector( '__field-value.range-value .%s__field-value-prefix' ) => 'color: {{VALUE}};', |
| 2088 | ), |
| 2089 | ) |
| 2090 | ); |
| 2091 | |
| 2092 | $this->add_responsive_control( |
| 2093 | 'range_suffix_value_size', |
| 2094 | array( |
| 2095 | 'label' => __( 'Suffix size', 'jet-form-builder' ), |
| 2096 | 'type' => Controls_Manager::SLIDER, |
| 2097 | 'size_units' => array( 'px', 'em', 'rem' ), |
| 2098 | 'range' => array( |
| 2099 | 'px' => array( |
| 2100 | 'min' => 10, |
| 2101 | 'max' => 50, |
| 2102 | ), |
| 2103 | ), |
| 2104 | 'selectors' => array( |
| 2105 | $this->selector( '__field-value.range-value .%s__field-value-suffix' ) => 'font-size: {{SIZE}}px;', |
| 2106 | ), |
| 2107 | 'separator' => 'before', |
| 2108 | ) |
| 2109 | ); |
| 2110 | |
| 2111 | $this->add_control( |
| 2112 | 'range_suffix_value_color', |
| 2113 | array( |
| 2114 | 'label' => __( 'Suffix Color', 'jet-form-builder' ), |
| 2115 | 'type' => Controls_Manager::COLOR, |
| 2116 | 'selectors' => array( |
| 2117 | $this->selector( '__field-value.range-value .%s__field-value-suffix' ) => 'color: {{VALUE}};', |
| 2118 | ), |
| 2119 | ) |
| 2120 | ); |
| 2121 | |
| 2122 | $this->end_controls_section(); |
| 2123 | }; |
| 2124 | $closure(); |
| 2125 | |
| 2126 | /** Heading Fields */ |
| 2127 | $closure = function () { |
| 2128 | $this->start_controls_section( |
| 2129 | 'section_headings_style', |
| 2130 | array( |
| 2131 | 'label' => __( 'Heading', 'jet-form-builder' ), |
| 2132 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2133 | 'show_label' => false, |
| 2134 | ) |
| 2135 | ); |
| 2136 | |
| 2137 | $this->add_control( |
| 2138 | 'field_heading_styles_heading', |
| 2139 | array( |
| 2140 | 'label' => esc_html__( 'Label', 'jet-form-builder' ), |
| 2141 | 'type' => Controls_Manager::HEADING, |
| 2142 | 'separator' => 'before', |
| 2143 | ) |
| 2144 | ); |
| 2145 | |
| 2146 | $this->add_group_control( |
| 2147 | Group_Control_Typography::get_type(), |
| 2148 | array( |
| 2149 | 'name' => 'field_heading_typography', |
| 2150 | 'selector' => $this->selector( '__heading' ), |
| 2151 | ) |
| 2152 | ); |
| 2153 | |
| 2154 | $this->add_control( |
| 2155 | 'fields_heading_color', |
| 2156 | array( |
| 2157 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 2158 | 'type' => Controls_Manager::COLOR, |
| 2159 | 'selectors' => array( |
| 2160 | $this->selector( '__heading' ) => 'color: {{VALUE}}', |
| 2161 | ), |
| 2162 | ) |
| 2163 | ); |
| 2164 | |
| 2165 | $this->add_responsive_control( |
| 2166 | 'fields_heading_gap', |
| 2167 | array( |
| 2168 | 'label' => __( 'Gap', 'jet-form-builder' ), |
| 2169 | 'type' => Controls_Manager::DIMENSIONS, |
| 2170 | 'size_units' => array( 'px' ), |
| 2171 | 'selectors' => array( |
| 2172 | $this->selector( '__heading' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2173 | ), |
| 2174 | ) |
| 2175 | ); |
| 2176 | |
| 2177 | $this->add_control( |
| 2178 | 'field_heading_styles_desc', |
| 2179 | array( |
| 2180 | 'label' => esc_html__( 'Description', 'jet-form-builder' ), |
| 2181 | 'type' => Controls_Manager::HEADING, |
| 2182 | 'separator' => 'before', |
| 2183 | ) |
| 2184 | ); |
| 2185 | |
| 2186 | $this->add_group_control( |
| 2187 | Group_Control_Typography::get_type(), |
| 2188 | array( |
| 2189 | 'name' => 'field_desc_typography', |
| 2190 | 'selector' => $this->selector( '__heading-desc' ), |
| 2191 | ) |
| 2192 | ); |
| 2193 | |
| 2194 | $this->add_control( |
| 2195 | 'fields_desc_color', |
| 2196 | array( |
| 2197 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 2198 | 'type' => Controls_Manager::COLOR, |
| 2199 | 'selectors' => array( |
| 2200 | $this->selector( '__heading-desc' ) => 'color: {{VALUE}}', |
| 2201 | ), |
| 2202 | ) |
| 2203 | ); |
| 2204 | |
| 2205 | $this->add_responsive_control( |
| 2206 | 'fields_heading_desc_gap', |
| 2207 | array( |
| 2208 | 'label' => __( 'Gap', 'jet-form-builder' ), |
| 2209 | 'type' => Controls_Manager::DIMENSIONS, |
| 2210 | 'size_units' => array( 'px' ), |
| 2211 | 'selectors' => array( |
| 2212 | $this->selector( '__heading-desc' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2213 | ), |
| 2214 | ) |
| 2215 | ); |
| 2216 | |
| 2217 | $this->end_controls_section(); |
| 2218 | }; |
| 2219 | $closure(); |
| 2220 | |
| 2221 | /** Repeater */ |
| 2222 | $closure = function () { |
| 2223 | $this->start_controls_section( |
| 2224 | 'section_repeater_style', |
| 2225 | array( |
| 2226 | 'label' => __( 'Repeater', 'jet-form-builder' ), |
| 2227 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2228 | 'show_label' => false, |
| 2229 | ) |
| 2230 | ); |
| 2231 | |
| 2232 | $this->add_control( |
| 2233 | 'field_repeater_row_desc', |
| 2234 | array( |
| 2235 | 'label' => esc_html__( 'Repeater row', 'jet-form-builder' ), |
| 2236 | 'type' => Controls_Manager::HEADING, |
| 2237 | 'separator' => 'before', |
| 2238 | ) |
| 2239 | ); |
| 2240 | |
| 2241 | $this->add_responsive_control( |
| 2242 | 'booking_form_repeater_row_padding', |
| 2243 | array( |
| 2244 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2245 | 'type' => Controls_Manager::DIMENSIONS, |
| 2246 | 'size_units' => array( 'px', '%', 'em' ), |
| 2247 | 'selectors' => array( |
| 2248 | $this->selector( '-repeater__row' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2249 | ), |
| 2250 | ) |
| 2251 | ); |
| 2252 | |
| 2253 | $this->add_control( |
| 2254 | 'field_repeater_new_desc', |
| 2255 | array( |
| 2256 | 'label' => esc_html__( 'New item button', 'jet-form-builder' ), |
| 2257 | 'type' => Controls_Manager::HEADING, |
| 2258 | 'separator' => 'before', |
| 2259 | ) |
| 2260 | ); |
| 2261 | |
| 2262 | $this->start_controls_tabs( 'tabs_booking_form_repeater_style' ); |
| 2263 | |
| 2264 | $this->start_controls_tab( |
| 2265 | 'booking_form_repeater_normal', |
| 2266 | array( |
| 2267 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 2268 | ) |
| 2269 | ); |
| 2270 | |
| 2271 | $this->add_control( |
| 2272 | 'booking_form_repeater_bg_color', |
| 2273 | array( |
| 2274 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2275 | 'type' => Controls_Manager::COLOR, |
| 2276 | 'selectors' => array( |
| 2277 | $this->selector( '-repeater__new' ) => 'background-color: {{VALUE}};', |
| 2278 | ), |
| 2279 | ) |
| 2280 | ); |
| 2281 | |
| 2282 | $this->add_control( |
| 2283 | 'booking_form_repeater_color', |
| 2284 | array( |
| 2285 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2286 | 'type' => Controls_Manager::COLOR, |
| 2287 | 'selectors' => array( |
| 2288 | $this->selector( '-repeater__new' ) => 'color: {{VALUE}};', |
| 2289 | ), |
| 2290 | ) |
| 2291 | ); |
| 2292 | |
| 2293 | $this->end_controls_tab(); |
| 2294 | |
| 2295 | $this->start_controls_tab( |
| 2296 | 'booking_form_repeater_hover', |
| 2297 | array( |
| 2298 | 'label' => esc_html__( 'Hover', 'jet-form-builder' ), |
| 2299 | ) |
| 2300 | ); |
| 2301 | |
| 2302 | $this->add_control( |
| 2303 | 'booking_form_repeater_bg_color_hover', |
| 2304 | array( |
| 2305 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2306 | 'type' => Controls_Manager::COLOR, |
| 2307 | 'selectors' => array( |
| 2308 | $this->selector( '-repeater__new:hover' ) => 'background-color: {{VALUE}};', |
| 2309 | ), |
| 2310 | ) |
| 2311 | ); |
| 2312 | |
| 2313 | $this->add_control( |
| 2314 | 'booking_form_repeater_color_hover', |
| 2315 | array( |
| 2316 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2317 | 'type' => Controls_Manager::COLOR, |
| 2318 | 'selectors' => array( |
| 2319 | $this->selector( '-repeater__new:hover' ) => 'color: {{VALUE}}', |
| 2320 | ), |
| 2321 | ) |
| 2322 | ); |
| 2323 | |
| 2324 | $this->add_control( |
| 2325 | 'booking_form_repeater_hover_border_color', |
| 2326 | array( |
| 2327 | 'label' => esc_html__( 'Border Color', 'jet-form-builder' ), |
| 2328 | 'type' => Controls_Manager::COLOR, |
| 2329 | 'condition' => array( |
| 2330 | 'booking_form_repeater_border_border!' => '', |
| 2331 | ), |
| 2332 | 'selectors' => array( |
| 2333 | $this->selector( '-repeater__new:hover' ) => 'border-color: {{VALUE}};', |
| 2334 | ), |
| 2335 | ) |
| 2336 | ); |
| 2337 | |
| 2338 | $this->end_controls_tab(); |
| 2339 | |
| 2340 | $this->end_controls_tabs(); |
| 2341 | |
| 2342 | $this->add_group_control( |
| 2343 | Group_Control_Typography::get_type(), |
| 2344 | array( |
| 2345 | 'name' => 'booking_form_repeater_typography', |
| 2346 | 'selector' => $this->selector( '-repeater__new' ), |
| 2347 | 'fields_options' => array( |
| 2348 | 'typography' => array( |
| 2349 | 'separator' => 'before', |
| 2350 | ), |
| 2351 | ), |
| 2352 | ) |
| 2353 | ); |
| 2354 | |
| 2355 | $this->add_responsive_control( |
| 2356 | 'booking_form_repeater_padding', |
| 2357 | array( |
| 2358 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2359 | 'type' => Controls_Manager::DIMENSIONS, |
| 2360 | 'size_units' => array( 'px', '%', 'em' ), |
| 2361 | 'selectors' => array( |
| 2362 | $this->selector( '-repeater__new' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2363 | ), |
| 2364 | ) |
| 2365 | ); |
| 2366 | |
| 2367 | $this->add_responsive_control( |
| 2368 | 'booking_form_repeater_margin', |
| 2369 | array( |
| 2370 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2371 | 'type' => Controls_Manager::DIMENSIONS, |
| 2372 | 'size_units' => array( 'px', '%', 'em' ), |
| 2373 | 'selectors' => array( |
| 2374 | $this->selector( '-repeater__new' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2375 | ), |
| 2376 | ) |
| 2377 | ); |
| 2378 | |
| 2379 | $this->add_group_control( |
| 2380 | Group_Control_Border::get_type(), |
| 2381 | array( |
| 2382 | 'name' => 'booking_form_repeater_border', |
| 2383 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2384 | 'placeholder' => '1px', |
| 2385 | 'selector' => $this->selector( '-repeater__new' ), |
| 2386 | ) |
| 2387 | ); |
| 2388 | |
| 2389 | $this->add_responsive_control( |
| 2390 | 'booking_form_repeater_border_radius', |
| 2391 | array( |
| 2392 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2393 | 'type' => Controls_Manager::DIMENSIONS, |
| 2394 | 'size_units' => array( 'px', '%' ), |
| 2395 | 'selectors' => array( |
| 2396 | $this->selector( '-repeater__new' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2397 | ), |
| 2398 | ) |
| 2399 | ); |
| 2400 | |
| 2401 | $this->add_group_control( |
| 2402 | Group_Control_Box_Shadow::get_type(), |
| 2403 | array( |
| 2404 | 'name' => 'booking_form_repeater_box_shadow', |
| 2405 | 'selector' => $this->selector( '-repeater__new' ), |
| 2406 | ) |
| 2407 | ); |
| 2408 | |
| 2409 | $this->add_responsive_control( |
| 2410 | 'booking_form_repeater_alignment', |
| 2411 | array( |
| 2412 | 'label' => esc_html__( 'Alignment', 'jet-form-builder' ), |
| 2413 | 'type' => Controls_Manager::CHOOSE, |
| 2414 | 'options' => array( |
| 2415 | 'flex-start' => array( |
| 2416 | 'title' => esc_html__( 'Start', 'jet-form-builder' ), |
| 2417 | 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 2418 | ), |
| 2419 | 'center' => array( |
| 2420 | 'title' => esc_html__( 'Center', 'jet-form-builder' ), |
| 2421 | 'icon' => 'eicon-h-align-center', |
| 2422 | ), |
| 2423 | 'flex-end' => array( |
| 2424 | 'title' => esc_html__( 'End', 'jet-form-builder' ), |
| 2425 | 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 2426 | ), |
| 2427 | ), |
| 2428 | 'selectors' => array( |
| 2429 | $this->selector( '-repeater__actions' ) => 'justify-content: {{VALUE}};', |
| 2430 | ), |
| 2431 | ) |
| 2432 | ); |
| 2433 | |
| 2434 | $this->add_control( |
| 2435 | 'field_repeater_del_desc', |
| 2436 | array( |
| 2437 | 'label' => esc_html__( 'Remove item button', 'jet-form-builder' ), |
| 2438 | 'type' => Controls_Manager::HEADING, |
| 2439 | 'separator' => 'before', |
| 2440 | ) |
| 2441 | ); |
| 2442 | |
| 2443 | $this->start_controls_tabs( 'tabs_booking_form_repeater_del_style' ); |
| 2444 | |
| 2445 | $this->start_controls_tab( |
| 2446 | 'booking_form_repeater_del_normal', |
| 2447 | array( |
| 2448 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 2449 | ) |
| 2450 | ); |
| 2451 | |
| 2452 | $this->add_control( |
| 2453 | 'booking_form_repeater_del_bg_color', |
| 2454 | array( |
| 2455 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2456 | 'type' => Controls_Manager::COLOR, |
| 2457 | 'selectors' => array( |
| 2458 | $this->selector( '-repeater__remove' ) => 'background-color: {{VALUE}}', |
| 2459 | ), |
| 2460 | ) |
| 2461 | ); |
| 2462 | |
| 2463 | $this->add_control( |
| 2464 | 'booking_form_repeater_del_color', |
| 2465 | array( |
| 2466 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2467 | 'type' => Controls_Manager::COLOR, |
| 2468 | 'selectors' => array( |
| 2469 | $this->selector( '-repeater__remove' ) => 'color: {{VALUE}}', |
| 2470 | ), |
| 2471 | ) |
| 2472 | ); |
| 2473 | |
| 2474 | $this->end_controls_tab(); |
| 2475 | |
| 2476 | $this->start_controls_tab( |
| 2477 | 'booking_form_repeater_del_hover', |
| 2478 | array( |
| 2479 | 'label' => esc_html__( 'Hover', 'jet-form-builder' ), |
| 2480 | ) |
| 2481 | ); |
| 2482 | |
| 2483 | $this->add_control( |
| 2484 | 'booking_form_repeater_del_bg_color_hover', |
| 2485 | array( |
| 2486 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2487 | 'type' => Controls_Manager::COLOR, |
| 2488 | 'selectors' => array( |
| 2489 | $this->selector( '-repeater__remove:hover' ) => 'background-color: {{VALUE}}', |
| 2490 | ), |
| 2491 | ) |
| 2492 | ); |
| 2493 | |
| 2494 | $this->add_control( |
| 2495 | 'booking_form_repeater_del_color_hover', |
| 2496 | array( |
| 2497 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2498 | 'type' => Controls_Manager::COLOR, |
| 2499 | 'selectors' => array( |
| 2500 | $this->selector( '-repeater__remove:hover' ) => 'color: {{VALUE}}', |
| 2501 | ), |
| 2502 | ) |
| 2503 | ); |
| 2504 | |
| 2505 | $this->add_control( |
| 2506 | 'booking_form_repeater_del_hover_border_color', |
| 2507 | array( |
| 2508 | 'label' => esc_html__( 'Border Color', 'jet-form-builder' ), |
| 2509 | 'type' => Controls_Manager::COLOR, |
| 2510 | 'condition' => array( |
| 2511 | 'booking_form_repeater_del_border_border!' => '', |
| 2512 | ), |
| 2513 | 'selectors' => array( |
| 2514 | $this->selector( '-repeater__remove:hover' ) => 'border-color: {{VALUE}};', |
| 2515 | ), |
| 2516 | ) |
| 2517 | ); |
| 2518 | |
| 2519 | $this->end_controls_tab(); |
| 2520 | |
| 2521 | $this->end_controls_tabs(); |
| 2522 | |
| 2523 | $this->add_responsive_control( |
| 2524 | 'booking_form_repeater_del_padding', |
| 2525 | array( |
| 2526 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2527 | 'type' => Controls_Manager::DIMENSIONS, |
| 2528 | 'size_units' => array( 'px', '%', 'em' ), |
| 2529 | 'separator' => 'before', |
| 2530 | 'selectors' => array( |
| 2531 | $this->selector( '-repeater__remove' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2532 | ), |
| 2533 | ) |
| 2534 | ); |
| 2535 | |
| 2536 | $this->add_responsive_control( |
| 2537 | 'booking_form_repeater_del_margin', |
| 2538 | array( |
| 2539 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2540 | 'type' => Controls_Manager::DIMENSIONS, |
| 2541 | 'size_units' => array( 'px', '%', 'em' ), |
| 2542 | 'selectors' => array( |
| 2543 | $this->selector( '-repeater__remove' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2544 | ), |
| 2545 | ) |
| 2546 | ); |
| 2547 | |
| 2548 | $this->add_group_control( |
| 2549 | Group_Control_Border::get_type(), |
| 2550 | array( |
| 2551 | 'name' => 'booking_form_repeater_del_border', |
| 2552 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2553 | 'placeholder' => '1px', |
| 2554 | 'selector' => $this->selector( '-repeater__remove' ), |
| 2555 | ) |
| 2556 | ); |
| 2557 | |
| 2558 | $this->add_responsive_control( |
| 2559 | 'booking_form_repeater_del_border_radius', |
| 2560 | array( |
| 2561 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2562 | 'type' => Controls_Manager::DIMENSIONS, |
| 2563 | 'size_units' => array( 'px', '%' ), |
| 2564 | 'selectors' => array( |
| 2565 | $this->selector( '-repeater__remove' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2566 | ), |
| 2567 | ) |
| 2568 | ); |
| 2569 | |
| 2570 | $this->add_control( |
| 2571 | 'booking_form_repeater_del_size', |
| 2572 | array( |
| 2573 | 'label' => esc_html__( 'Icon Size', 'jet-form-builder' ), |
| 2574 | 'type' => Controls_Manager::SLIDER, |
| 2575 | 'size_units' => array( 'px' ), |
| 2576 | 'range' => array( |
| 2577 | 'px' => array( |
| 2578 | 'min' => 12, |
| 2579 | 'max' => 90, |
| 2580 | ), |
| 2581 | ), |
| 2582 | 'selectors' => array( |
| 2583 | $this->selector( '-repeater__remove' ) => 'font-size: {{SIZE}}{{UNIT}};line-height: {{SIZE}}{{UNIT}};', |
| 2584 | ), |
| 2585 | ) |
| 2586 | ); |
| 2587 | |
| 2588 | $this->add_group_control( |
| 2589 | Group_Control_Box_Shadow::get_type(), |
| 2590 | array( |
| 2591 | 'name' => 'booking_form_repeater_del_box_shadow', |
| 2592 | 'selector' => $this->selector( '-repeater__remove' ), |
| 2593 | ) |
| 2594 | ); |
| 2595 | |
| 2596 | $this->add_responsive_control( |
| 2597 | 'booking_form_repeater_del_alignment', |
| 2598 | array( |
| 2599 | 'label' => esc_html__( 'Alignment', 'jet-form-builder' ), |
| 2600 | 'type' => Controls_Manager::CHOOSE, |
| 2601 | 'default' => 'flex-start', |
| 2602 | 'options' => array( |
| 2603 | 'flex-start' => array( |
| 2604 | 'title' => esc_html__( 'Top', 'jet-form-builder' ), |
| 2605 | 'icon' => 'eicon-v-align-top', |
| 2606 | ), |
| 2607 | 'center' => array( |
| 2608 | 'title' => esc_html__( 'Middle', 'jet-form-builder' ), |
| 2609 | 'icon' => 'eicon-v-align-middle', |
| 2610 | ), |
| 2611 | 'flex-end' => array( |
| 2612 | 'title' => esc_html__( 'Bottom', 'jet-form-builder' ), |
| 2613 | 'icon' => 'eicon-v-align-bottom', |
| 2614 | ), |
| 2615 | ), |
| 2616 | 'selectors' => array( |
| 2617 | $this->selector( '-repeater__row-remove' ) => 'align-self: {{VALUE}};', |
| 2618 | ), |
| 2619 | ) |
| 2620 | ); |
| 2621 | |
| 2622 | $this->end_controls_section(); |
| 2623 | }; |
| 2624 | $closure(); |
| 2625 | |
| 2626 | /** Conditional block */ |
| 2627 | $closure = function () { |
| 2628 | $this->start_controls_section( |
| 2629 | 'conditional_style', |
| 2630 | array( |
| 2631 | 'label' => esc_html__( 'Conditional block', 'jet-form-builder' ), |
| 2632 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2633 | 'show_label' => false, |
| 2634 | ) |
| 2635 | ); |
| 2636 | |
| 2637 | $this->add_responsive_control( |
| 2638 | 'conditional_padding', |
| 2639 | array( |
| 2640 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2641 | 'type' => Controls_Manager::DIMENSIONS, |
| 2642 | 'size_units' => array( 'px', '%', 'em' ), |
| 2643 | 'selectors' => array( |
| 2644 | $this->selector( '__conditional' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2645 | ), |
| 2646 | ) |
| 2647 | ); |
| 2648 | |
| 2649 | $this->add_responsive_control( |
| 2650 | 'conditional_margin', |
| 2651 | array( |
| 2652 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2653 | 'type' => Controls_Manager::DIMENSIONS, |
| 2654 | 'size_units' => array( 'px', '%', 'em' ), |
| 2655 | 'selectors' => array( |
| 2656 | $this->selector( '__conditional' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2657 | ), |
| 2658 | ) |
| 2659 | ); |
| 2660 | |
| 2661 | $this->add_group_control( |
| 2662 | Group_Control_Border::get_type(), |
| 2663 | array( |
| 2664 | 'name' => 'conditional_border', |
| 2665 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2666 | 'placeholder' => '1px', |
| 2667 | 'selector' => $this->selector( '__conditional' ), |
| 2668 | ) |
| 2669 | ); |
| 2670 | |
| 2671 | $this->add_responsive_control( |
| 2672 | 'conditional_border_radius', |
| 2673 | array( |
| 2674 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2675 | 'type' => Controls_Manager::DIMENSIONS, |
| 2676 | 'size_units' => array( 'px', '%' ), |
| 2677 | 'selectors' => array( |
| 2678 | $this->selector( '__conditional' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2679 | ), |
| 2680 | ) |
| 2681 | ); |
| 2682 | |
| 2683 | $this->add_group_control( |
| 2684 | Group_Control_Box_Shadow::get_type(), |
| 2685 | array( |
| 2686 | 'name' => 'conditional_box_shadow', |
| 2687 | 'selector' => $this->selector( '__conditional' ), |
| 2688 | ) |
| 2689 | ); |
| 2690 | |
| 2691 | $this->add_control( |
| 2692 | 'conditional_bg_color', |
| 2693 | array( |
| 2694 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2695 | 'type' => Controls_Manager::COLOR, |
| 2696 | 'selectors' => array( |
| 2697 | $this->selector( '__conditional' ) => 'background-color: {{VALUE}}', |
| 2698 | ), |
| 2699 | ) |
| 2700 | ); |
| 2701 | |
| 2702 | $this->end_controls_section(); |
| 2703 | }; |
| 2704 | $closure(); |
| 2705 | |
| 2706 | /** Submit */ |
| 2707 | $closure = function () { |
| 2708 | $this->start_controls_section( |
| 2709 | 'form_submit_style', |
| 2710 | array( |
| 2711 | 'label' => esc_html__( 'Submit', 'jet-form-builder' ), |
| 2712 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2713 | 'show_label' => false, |
| 2714 | ) |
| 2715 | ); |
| 2716 | |
| 2717 | $this->start_controls_tabs( 'tabs_booking_form_submit_style' ); |
| 2718 | |
| 2719 | $this->start_controls_tab( |
| 2720 | 'booking_form_submit_normal', |
| 2721 | array( |
| 2722 | 'label' => esc_html__( 'Normal', 'jet-form-builder' ), |
| 2723 | ) |
| 2724 | ); |
| 2725 | |
| 2726 | $this->add_control( |
| 2727 | 'booking_form_submit_bg_color', |
| 2728 | array( |
| 2729 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2730 | 'type' => Controls_Manager::COLOR, |
| 2731 | 'selectors' => array( |
| 2732 | $this->selector( '__action-button' ) => 'background-color: {{VALUE}}', |
| 2733 | ), |
| 2734 | ) |
| 2735 | ); |
| 2736 | |
| 2737 | $this->add_control( |
| 2738 | 'booking_form_submit_color', |
| 2739 | array( |
| 2740 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2741 | 'type' => Controls_Manager::COLOR, |
| 2742 | 'selectors' => array( |
| 2743 | $this->selector( '__action-button' ) => 'color: {{VALUE}}', |
| 2744 | ), |
| 2745 | ) |
| 2746 | ); |
| 2747 | |
| 2748 | $this->end_controls_tab(); |
| 2749 | |
| 2750 | $this->start_controls_tab( |
| 2751 | 'booking_form_submit_hover', |
| 2752 | array( |
| 2753 | 'label' => esc_html__( 'Hover', 'jet-form-builder' ), |
| 2754 | ) |
| 2755 | ); |
| 2756 | |
| 2757 | $this->add_control( |
| 2758 | 'booking_form_submit_bg_color_hover', |
| 2759 | array( |
| 2760 | 'label' => esc_html__( 'Background Color', 'jet-form-builder' ), |
| 2761 | 'type' => Controls_Manager::COLOR, |
| 2762 | 'selectors' => array( |
| 2763 | $this->selector( '__action-button:hover' ) => 'background-color: {{VALUE}}', |
| 2764 | ), |
| 2765 | ) |
| 2766 | ); |
| 2767 | |
| 2768 | $this->add_control( |
| 2769 | 'booking_form_submit_color_hover', |
| 2770 | array( |
| 2771 | 'label' => esc_html__( 'Text Color', 'jet-form-builder' ), |
| 2772 | 'type' => Controls_Manager::COLOR, |
| 2773 | 'selectors' => array( |
| 2774 | $this->selector( '__action-button:hover' ) => 'color: {{VALUE}}', |
| 2775 | ), |
| 2776 | ) |
| 2777 | ); |
| 2778 | |
| 2779 | $this->add_control( |
| 2780 | 'booking_form_submit_hover_border_color', |
| 2781 | array( |
| 2782 | 'label' => esc_html__( 'Border Color', 'jet-form-builder' ), |
| 2783 | 'type' => Controls_Manager::COLOR, |
| 2784 | 'condition' => array( |
| 2785 | 'booking_form_submit_border_border!' => '', |
| 2786 | ), |
| 2787 | 'selectors' => array( |
| 2788 | $this->selector( '__action-button:hover' ) => 'border-color: {{VALUE}};', |
| 2789 | ), |
| 2790 | ) |
| 2791 | ); |
| 2792 | |
| 2793 | $this->end_controls_tab(); |
| 2794 | |
| 2795 | $this->end_controls_tabs(); |
| 2796 | |
| 2797 | $this->add_group_control( |
| 2798 | Group_Control_Typography::get_type(), |
| 2799 | array( |
| 2800 | 'name' => 'booking_form_submit_typography', |
| 2801 | 'selector' => $this->selector( '__action-button' ), |
| 2802 | 'fields_options' => array( |
| 2803 | 'typography' => array( |
| 2804 | 'separator' => 'after', |
| 2805 | ), |
| 2806 | ), |
| 2807 | ) |
| 2808 | ); |
| 2809 | |
| 2810 | $this->add_responsive_control( |
| 2811 | 'booking_form_submit_padding', |
| 2812 | array( |
| 2813 | 'label' => esc_html__( 'Padding', 'jet-form-builder' ), |
| 2814 | 'type' => Controls_Manager::DIMENSIONS, |
| 2815 | 'size_units' => array( 'px', '%', 'em' ), |
| 2816 | 'selectors' => array( |
| 2817 | $this->selector( '__action-button' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2818 | ), |
| 2819 | ) |
| 2820 | ); |
| 2821 | |
| 2822 | $this->add_responsive_control( |
| 2823 | 'booking_form_submit_margin', |
| 2824 | array( |
| 2825 | 'label' => esc_html__( 'Margin', 'jet-form-builder' ), |
| 2826 | 'type' => Controls_Manager::DIMENSIONS, |
| 2827 | 'size_units' => array( 'px', '%', 'em' ), |
| 2828 | 'selectors' => array( |
| 2829 | $this->selector( '__action-button' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2830 | ), |
| 2831 | ) |
| 2832 | ); |
| 2833 | |
| 2834 | $this->add_group_control( |
| 2835 | Group_Control_Border::get_type(), |
| 2836 | array( |
| 2837 | 'name' => 'booking_form_submit_border', |
| 2838 | 'label' => esc_html__( 'Border', 'jet-form-builder' ), |
| 2839 | 'placeholder' => '1px', |
| 2840 | 'selector' => $this->selector( '__action-button' ), |
| 2841 | ) |
| 2842 | ); |
| 2843 | |
| 2844 | $this->add_responsive_control( |
| 2845 | 'booking_form_submit_border_radius', |
| 2846 | array( |
| 2847 | 'label' => esc_html__( 'Border Radius', 'jet-form-builder' ), |
| 2848 | 'type' => Controls_Manager::DIMENSIONS, |
| 2849 | 'size_units' => array( 'px', '%' ), |
| 2850 | 'selectors' => array( |
| 2851 | $this->selector( '__action-button' ) => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2852 | ), |
| 2853 | ) |
| 2854 | ); |
| 2855 | |
| 2856 | $this->add_group_control( |
| 2857 | Group_Control_Box_Shadow::get_type(), |
| 2858 | array( |
| 2859 | 'name' => 'booking_form_submit_box_shadow', |
| 2860 | 'selector' => $this->selector( '__action-button' ), |
| 2861 | ) |
| 2862 | ); |
| 2863 | |
| 2864 | $this->add_responsive_control( |
| 2865 | 'booking_form_submit_alignment', |
| 2866 | array( |
| 2867 | 'label' => esc_html__( 'Alignment', 'jet-form-builder' ), |
| 2868 | 'type' => Controls_Manager::CHOOSE, |
| 2869 | 'options' => array( |
| 2870 | 'flex-start' => array( |
| 2871 | 'title' => esc_html__( 'Start', 'jet-form-builder' ), |
| 2872 | 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 2873 | ), |
| 2874 | 'center' => array( |
| 2875 | 'title' => esc_html__( 'Center', 'jet-form-builder' ), |
| 2876 | 'icon' => 'eicon-h-align-center', |
| 2877 | ), |
| 2878 | 'flex-end' => array( |
| 2879 | 'title' => esc_html__( 'End', 'jet-form-builder' ), |
| 2880 | 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 2881 | ), |
| 2882 | 'stretch' => array( |
| 2883 | 'title' => esc_html__( 'Fullwidth', 'jet-form-builder' ), |
| 2884 | 'icon' => 'eicon-h-align-stretch', |
| 2885 | ), |
| 2886 | ), |
| 2887 | 'selectors' => array( |
| 2888 | $this->selector( '__submit-wrap' ) => 'justify-content: {{VALUE}}; align-items: {{VALUE}};', |
| 2889 | ), |
| 2890 | ) |
| 2891 | ); |
| 2892 | |
| 2893 | $this->add_control( |
| 2894 | 'booking_form_submit_alignment_hidden', |
| 2895 | array( |
| 2896 | 'type' => Controls_Manager::HIDDEN, |
| 2897 | 'default' => 'style', |
| 2898 | 'selectors' => array( |
| 2899 | $this->selector( '__submit-wrap > .%s__submit' ) => 'width: 100%', |
| 2900 | ), |
| 2901 | 'condition' => array( |
| 2902 | 'booking_form_submit_alignment' => 'stretch', |
| 2903 | ), |
| 2904 | ) |
| 2905 | ); |
| 2906 | |
| 2907 | $this->add_responsive_control( |
| 2908 | 'booking_form_submit_alignment_text', |
| 2909 | array( |
| 2910 | 'label' => esc_html__( 'Button Text Alignment', 'jet-form-builder' ), |
| 2911 | 'type' => Controls_Manager::CHOOSE, |
| 2912 | 'options' => array( |
| 2913 | 'flex-start' => array( |
| 2914 | 'title' => esc_html__( 'Start', 'jet-form-builder' ), |
| 2915 | 'icon' => ! is_rtl() ? 'eicon-h-align-left' : 'eicon-h-align-right', |
| 2916 | ), |
| 2917 | 'center' => array( |
| 2918 | 'title' => esc_html__( 'Center', 'jet-form-builder' ), |
| 2919 | 'icon' => 'eicon-h-align-center', |
| 2920 | ), |
| 2921 | 'flex-end' => array( |
| 2922 | 'title' => esc_html__( 'End', 'jet-form-builder' ), |
| 2923 | 'icon' => ! is_rtl() ? 'eicon-h-align-right' : 'eicon-h-align-left', |
| 2924 | ), |
| 2925 | ), |
| 2926 | 'selectors' => array( |
| 2927 | $this->selector( '__submit' ) => 'justify-content: {{VALUE}};', |
| 2928 | ), |
| 2929 | ) |
| 2930 | ); |
| 2931 | |
| 2932 | $this->end_controls_section(); |
| 2933 | }; |
| 2934 | $closure(); |
| 2935 | |
| 2936 | /** Form Break Row */ |
| 2937 | $closure = function () { |
| 2938 | |
| 2939 | $this->start_controls_section( |
| 2940 | 'section_form_break_style', |
| 2941 | array( |
| 2942 | 'label' => __( 'Form Break Row', 'jet-form-builder' ), |
| 2943 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2944 | ) |
| 2945 | ); |
| 2946 | |
| 2947 | $this->add_responsive_control( |
| 2948 | 'form_break_gap', |
| 2949 | array( |
| 2950 | 'label' => __( 'Gap', 'jet-form-builder' ), |
| 2951 | 'type' => Controls_Manager::DIMENSIONS, |
| 2952 | 'size_units' => array( 'px' ), |
| 2953 | 'selectors' => array( |
| 2954 | $this->selector( '__next-page-wrap' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2955 | ), |
| 2956 | ) |
| 2957 | ); |
| 2958 | |
| 2959 | $this->add_responsive_control( |
| 2960 | 'form_break_alignment', |
| 2961 | array( |
| 2962 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 2963 | 'type' => Controls_Manager::CHOOSE, |
| 2964 | 'label_block' => false, |
| 2965 | 'default' => 'left', |
| 2966 | 'separator' => 'before', |
| 2967 | 'options' => array( |
| 2968 | 'left' => array( |
| 2969 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 2970 | 'icon' => 'eicon-h-align-left', |
| 2971 | ), |
| 2972 | 'center' => array( |
| 2973 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 2974 | 'icon' => 'eicon-h-align-center', |
| 2975 | ), |
| 2976 | 'right' => array( |
| 2977 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 2978 | 'icon' => 'eicon-h-align-right', |
| 2979 | ), |
| 2980 | ), |
| 2981 | 'selectors' => array( |
| 2982 | $this->selector( '__next-page-wrap' ) => 'text-align: {{VALUE}};', |
| 2983 | ), |
| 2984 | ) |
| 2985 | ); |
| 2986 | |
| 2987 | $this->add_border( |
| 2988 | $this, |
| 2989 | 'form_break_border', |
| 2990 | $this->selector( '__next-page-wrap' ) |
| 2991 | ); |
| 2992 | |
| 2993 | $this->end_controls_section(); |
| 2994 | }; |
| 2995 | $closure(); |
| 2996 | |
| 2997 | /** Form Break Buttons */ |
| 2998 | $closure = function () { |
| 2999 | $this->start_controls_section( |
| 3000 | 'section_form_break_next_style', |
| 3001 | array( |
| 3002 | 'label' => __( 'Form Break Buttons', 'jet-form-builder' ), |
| 3003 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3004 | ) |
| 3005 | ); |
| 3006 | |
| 3007 | $this->add_control( |
| 3008 | 'form_break_next_button__error_heading', |
| 3009 | array( |
| 3010 | 'label' => __( 'Next Button', 'jet-form-builder' ), |
| 3011 | 'type' => Controls_Manager::HEADING, |
| 3012 | 'separator' => 'after', |
| 3013 | ) |
| 3014 | ); |
| 3015 | |
| 3016 | $this->add_responsive_control( |
| 3017 | 'form_break_next_margin', |
| 3018 | array( |
| 3019 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3020 | 'type' => Controls_Manager::DIMENSIONS, |
| 3021 | 'size_units' => array( 'px' ), |
| 3022 | 'selectors' => array( |
| 3023 | $this->selector( '__next-page' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3024 | ), |
| 3025 | ) |
| 3026 | ); |
| 3027 | |
| 3028 | $this->add_responsive_control( |
| 3029 | 'form_break_next_padding', |
| 3030 | array( |
| 3031 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3032 | 'type' => Controls_Manager::DIMENSIONS, |
| 3033 | 'size_units' => array( 'px' ), |
| 3034 | 'selectors' => array( |
| 3035 | $this->selector( '__next-page' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3036 | ), |
| 3037 | ) |
| 3038 | ); |
| 3039 | |
| 3040 | $this->add_responsive_control( |
| 3041 | 'form_break_next_justify', |
| 3042 | array( |
| 3043 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3044 | 'type' => Controls_Manager::CHOOSE, |
| 3045 | 'label_block' => false, |
| 3046 | 'options' => array( |
| 3047 | 'flex-start' => array( |
| 3048 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3049 | 'icon' => 'eicon-h-align-left', |
| 3050 | ), |
| 3051 | 'center' => array( |
| 3052 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3053 | 'icon' => 'eicon-h-align-center', |
| 3054 | ), |
| 3055 | 'flex-end' => array( |
| 3056 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3057 | 'icon' => 'eicon-h-align-right', |
| 3058 | ), |
| 3059 | ), |
| 3060 | 'selectors' => array( |
| 3061 | $this->selector( '-row .%s__action-button-wrapper[data-type="next"]' ) => 'justify-content: {{VALUE}};', |
| 3062 | ), |
| 3063 | ) |
| 3064 | ); |
| 3065 | |
| 3066 | $this->start_controls_tabs( 'form_break_next_styles' ); |
| 3067 | |
| 3068 | $this->start_controls_tab( |
| 3069 | 'form_break_next--normal', |
| 3070 | array( |
| 3071 | 'label' => __( 'Normal', 'jet-form-builder' ), |
| 3072 | ) |
| 3073 | ); |
| 3074 | |
| 3075 | $this->add_group_control( |
| 3076 | Group_Control_Typography::get_type(), |
| 3077 | array( |
| 3078 | 'name' => 'form_break_next_typography', |
| 3079 | 'selector' => $this->selector( '__next-page' ), |
| 3080 | ) |
| 3081 | ); |
| 3082 | |
| 3083 | $this->add_border( |
| 3084 | $this, |
| 3085 | 'form_break_next_border', |
| 3086 | $this->selector( '__next-page' ) |
| 3087 | ); |
| 3088 | |
| 3089 | $this->add_control( |
| 3090 | 'form_break_next_color--normal', |
| 3091 | array( |
| 3092 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3093 | 'type' => Controls_Manager::COLOR, |
| 3094 | 'selectors' => array( |
| 3095 | $this->selector( '__next-page' ) => 'color: {{VALUE}};', |
| 3096 | ), |
| 3097 | ) |
| 3098 | ); |
| 3099 | |
| 3100 | $this->add_control( |
| 3101 | 'form_break_next_bg_color--normal', |
| 3102 | array( |
| 3103 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3104 | 'type' => Controls_Manager::COLOR, |
| 3105 | 'selectors' => array( |
| 3106 | $this->selector( '__next-page' ) => 'background-color: {{VALUE}};', |
| 3107 | ), |
| 3108 | ) |
| 3109 | ); |
| 3110 | |
| 3111 | $this->end_controls_tab(); |
| 3112 | |
| 3113 | $this->start_controls_tab( |
| 3114 | 'form_break_next--hover', |
| 3115 | array( |
| 3116 | 'label' => __( 'Hover', 'jet-form-builder' ), |
| 3117 | ) |
| 3118 | ); |
| 3119 | |
| 3120 | $this->add_group_control( |
| 3121 | Group_Control_Typography::get_type(), |
| 3122 | array( |
| 3123 | 'name' => 'form_break_next_typography--hover', |
| 3124 | 'selector' => $this->selector( '__next-page:hover' ), |
| 3125 | ) |
| 3126 | ); |
| 3127 | |
| 3128 | $this->add_border( |
| 3129 | $this, |
| 3130 | 'form_break_next_border--hover', |
| 3131 | $this->selector( '__next-page:hover' ) |
| 3132 | ); |
| 3133 | |
| 3134 | $this->add_control( |
| 3135 | 'form_break_next_color--hover', |
| 3136 | array( |
| 3137 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3138 | 'type' => Controls_Manager::COLOR, |
| 3139 | 'selectors' => array( |
| 3140 | $this->selector( '__next-page:hover' ) => 'color: {{VALUE}};', |
| 3141 | ), |
| 3142 | ) |
| 3143 | ); |
| 3144 | $this->add_control( |
| 3145 | 'form_break_next_bg_color--hover', |
| 3146 | array( |
| 3147 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3148 | 'type' => Controls_Manager::COLOR, |
| 3149 | 'selectors' => array( |
| 3150 | $this->selector( '__next-page:hover' ) => 'background-color: {{VALUE}};', |
| 3151 | ), |
| 3152 | ) |
| 3153 | ); |
| 3154 | |
| 3155 | $this->end_controls_tab(); |
| 3156 | $this->end_controls_tabs(); |
| 3157 | |
| 3158 | $this->add_control( |
| 3159 | 'form_break_prev_button__error_heading', |
| 3160 | array( |
| 3161 | 'label' => __( 'Prev Button', 'jet-form-builder' ), |
| 3162 | 'type' => Controls_Manager::HEADING, |
| 3163 | 'separator' => 'before', |
| 3164 | ) |
| 3165 | ); |
| 3166 | |
| 3167 | $this->add_responsive_control( |
| 3168 | 'form_break_prev_margin', |
| 3169 | array( |
| 3170 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3171 | 'type' => Controls_Manager::DIMENSIONS, |
| 3172 | 'size_units' => array( 'px' ), |
| 3173 | 'selectors' => array( |
| 3174 | $this->selector( '__prev-page' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3175 | ), |
| 3176 | ) |
| 3177 | ); |
| 3178 | |
| 3179 | $this->add_responsive_control( |
| 3180 | 'form_break_prev_padding', |
| 3181 | array( |
| 3182 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3183 | 'type' => Controls_Manager::DIMENSIONS, |
| 3184 | 'size_units' => array( 'px' ), |
| 3185 | 'selectors' => array( |
| 3186 | $this->selector( '__prev-page' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3187 | ), |
| 3188 | ) |
| 3189 | ); |
| 3190 | |
| 3191 | $this->add_responsive_control( |
| 3192 | 'form_break_prev_justify', |
| 3193 | array( |
| 3194 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3195 | 'type' => Controls_Manager::CHOOSE, |
| 3196 | 'label_block' => false, |
| 3197 | 'options' => array( |
| 3198 | 'flex-start' => array( |
| 3199 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3200 | 'icon' => 'eicon-h-align-left', |
| 3201 | ), |
| 3202 | 'center' => array( |
| 3203 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3204 | 'icon' => 'eicon-h-align-center', |
| 3205 | ), |
| 3206 | 'flex-end' => array( |
| 3207 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3208 | 'icon' => 'eicon-h-align-right', |
| 3209 | ), |
| 3210 | ), |
| 3211 | 'selectors' => array( |
| 3212 | $this->selector( '-row .%s__action-button-wrapper[data-type="prev"]' ) => 'justify-content: {{VALUE}};', |
| 3213 | ), |
| 3214 | ) |
| 3215 | ); |
| 3216 | |
| 3217 | $this->start_controls_tabs( 'form_break_prev_styles' ); |
| 3218 | |
| 3219 | $this->start_controls_tab( |
| 3220 | 'form_break_prev--normal', |
| 3221 | array( |
| 3222 | 'label' => __( 'Normal', 'jet-form-builder' ), |
| 3223 | ) |
| 3224 | ); |
| 3225 | |
| 3226 | $this->add_group_control( |
| 3227 | Group_Control_Typography::get_type(), |
| 3228 | array( |
| 3229 | 'name' => 'form_break_prev_typography', |
| 3230 | 'selector' => $this->selector( '__prev-page' ), |
| 3231 | ) |
| 3232 | ); |
| 3233 | |
| 3234 | $this->add_border( |
| 3235 | $this, |
| 3236 | 'form_break_prev_border', |
| 3237 | $this->selector( '__prev-page' ) |
| 3238 | ); |
| 3239 | |
| 3240 | $this->add_control( |
| 3241 | 'form_break_prev_color--normal', |
| 3242 | array( |
| 3243 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3244 | 'type' => Controls_Manager::COLOR, |
| 3245 | 'selectors' => array( |
| 3246 | $this->selector( '__prev-page' ) => 'color: {{VALUE}};', |
| 3247 | ), |
| 3248 | ) |
| 3249 | ); |
| 3250 | |
| 3251 | $this->add_control( |
| 3252 | 'form_break_prev_bg_color--normal', |
| 3253 | array( |
| 3254 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3255 | 'type' => Controls_Manager::COLOR, |
| 3256 | 'selectors' => array( |
| 3257 | $this->selector( '__prev-page' ) => 'background-color: {{VALUE}};', |
| 3258 | ), |
| 3259 | ) |
| 3260 | ); |
| 3261 | |
| 3262 | $this->end_controls_tab(); |
| 3263 | |
| 3264 | $this->start_controls_tab( |
| 3265 | 'form_break_prev--hover', |
| 3266 | array( |
| 3267 | 'label' => __( 'Hover', 'jet-form-builder' ), |
| 3268 | ) |
| 3269 | ); |
| 3270 | |
| 3271 | $this->add_group_control( |
| 3272 | Group_Control_Typography::get_type(), |
| 3273 | array( |
| 3274 | 'name' => 'form_break_prev_typography--hover', |
| 3275 | 'selector' => $this->selector( '__prev-page:hover' ), |
| 3276 | ) |
| 3277 | ); |
| 3278 | |
| 3279 | $this->add_border( |
| 3280 | $this, |
| 3281 | 'form_break_prev_border--hover', |
| 3282 | $this->selector( '__prev-page:hover' ) |
| 3283 | ); |
| 3284 | |
| 3285 | $this->add_control( |
| 3286 | 'form_break_prev_color--hover', |
| 3287 | array( |
| 3288 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3289 | 'type' => Controls_Manager::COLOR, |
| 3290 | 'selectors' => array( |
| 3291 | $this->selector( '__prev-page:hover' ) => 'color: {{VALUE}};', |
| 3292 | ), |
| 3293 | ) |
| 3294 | ); |
| 3295 | $this->add_control( |
| 3296 | 'form_break_prev_bg_color--hover', |
| 3297 | array( |
| 3298 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3299 | 'type' => Controls_Manager::COLOR, |
| 3300 | 'selectors' => array( |
| 3301 | $this->selector( '__prev-page:hover' ) => 'background-color: {{VALUE}};', |
| 3302 | ), |
| 3303 | ) |
| 3304 | ); |
| 3305 | |
| 3306 | $this->end_controls_tab(); |
| 3307 | $this->end_controls_tabs(); |
| 3308 | |
| 3309 | $this->end_controls_section(); |
| 3310 | }; |
| 3311 | $closure(); |
| 3312 | |
| 3313 | /** Form Break Disabled Message */ |
| 3314 | $closure = function () { |
| 3315 | $this->start_controls_section( |
| 3316 | 'section_form_break_disabled_style', |
| 3317 | array( |
| 3318 | 'label' => __( 'Form Break Disabled Message', 'jet-form-builder' ), |
| 3319 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3320 | ) |
| 3321 | ); |
| 3322 | |
| 3323 | $this->add_responsive_control( |
| 3324 | 'form_break_disabled_margin', |
| 3325 | array( |
| 3326 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3327 | 'type' => Controls_Manager::DIMENSIONS, |
| 3328 | 'size_units' => array( 'px' ), |
| 3329 | 'selectors' => array( |
| 3330 | $this->selector( '__next-page-msg' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3331 | ), |
| 3332 | ) |
| 3333 | ); |
| 3334 | |
| 3335 | $this->add_responsive_control( |
| 3336 | 'form_break_disabled_padding', |
| 3337 | array( |
| 3338 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3339 | 'type' => Controls_Manager::DIMENSIONS, |
| 3340 | 'size_units' => array( 'px' ), |
| 3341 | 'selectors' => array( |
| 3342 | $this->selector( '__next-page-msg' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3343 | ), |
| 3344 | ) |
| 3345 | ); |
| 3346 | |
| 3347 | $this->add_group_control( |
| 3348 | Group_Control_Typography::get_type(), |
| 3349 | array( |
| 3350 | 'name' => 'form_break_disabled_typography', |
| 3351 | 'selector' => $this->selector( '__next-page-msg' ), |
| 3352 | ) |
| 3353 | ); |
| 3354 | |
| 3355 | $this->add_border( |
| 3356 | $this, |
| 3357 | 'form_break_disabled_border', |
| 3358 | $this->selector( '__next-page-msg' ) |
| 3359 | ); |
| 3360 | |
| 3361 | $this->end_controls_section(); |
| 3362 | }; |
| 3363 | $closure(); |
| 3364 | |
| 3365 | $this->run_form_progress_controls( |
| 3366 | $this, |
| 3367 | array( $this, 'selector' ), |
| 3368 | function ( $args ) { |
| 3369 | return $args; |
| 3370 | } |
| 3371 | ); |
| 3372 | |
| 3373 | /** Messages */ |
| 3374 | $closure = function () { |
| 3375 | $this->start_controls_section( |
| 3376 | 'section_message_error_style', |
| 3377 | array( |
| 3378 | 'label' => __( 'Messages', 'jet-form-builder' ), |
| 3379 | 'tab' => Controls_Manager::TAB_STYLE, |
| 3380 | ) |
| 3381 | ); |
| 3382 | |
| 3383 | $this->start_controls_tabs( 'section_messages_tabs' ); |
| 3384 | |
| 3385 | $this->start_controls_tab( |
| 3386 | 'messages_success_tab', |
| 3387 | array( |
| 3388 | 'label' => __( 'Success Message', 'jet-form-builder' ), |
| 3389 | ) |
| 3390 | ); |
| 3391 | |
| 3392 | $this->add_responsive_control( |
| 3393 | 'form_success_margin', |
| 3394 | array( |
| 3395 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3396 | 'type' => Controls_Manager::DIMENSIONS, |
| 3397 | 'size_units' => array( 'px' ), |
| 3398 | 'selectors' => array( |
| 3399 | $this->selector( '-message--success' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3400 | ), |
| 3401 | ) |
| 3402 | ); |
| 3403 | |
| 3404 | $this->add_responsive_control( |
| 3405 | 'form_success_padding', |
| 3406 | array( |
| 3407 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3408 | 'type' => Controls_Manager::DIMENSIONS, |
| 3409 | 'size_units' => array( 'px' ), |
| 3410 | 'selectors' => array( |
| 3411 | $this->selector( '-message--success' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3412 | ), |
| 3413 | ) |
| 3414 | ); |
| 3415 | |
| 3416 | $this->add_responsive_control( |
| 3417 | 'form_success_alignment', |
| 3418 | array( |
| 3419 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3420 | 'type' => Controls_Manager::CHOOSE, |
| 3421 | 'label_block' => false, |
| 3422 | 'default' => 'center', |
| 3423 | 'separator' => 'before', |
| 3424 | 'options' => array( |
| 3425 | 'left' => array( |
| 3426 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3427 | 'icon' => 'eicon-h-align-left', |
| 3428 | ), |
| 3429 | 'center' => array( |
| 3430 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3431 | 'icon' => 'eicon-h-align-center', |
| 3432 | ), |
| 3433 | 'right' => array( |
| 3434 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3435 | 'icon' => 'eicon-h-align-right', |
| 3436 | ), |
| 3437 | ), |
| 3438 | 'selectors' => array( |
| 3439 | $this->selector( '-message--success' ) => 'text-align: {{VALUE}};', |
| 3440 | ), |
| 3441 | ) |
| 3442 | ); |
| 3443 | |
| 3444 | $this->add_group_control( |
| 3445 | Group_Control_Typography::get_type(), |
| 3446 | array( |
| 3447 | 'name' => 'form_success_typography', |
| 3448 | 'selector' => $this->selector( '-message--success' ), |
| 3449 | ) |
| 3450 | ); |
| 3451 | |
| 3452 | $this->add_control( |
| 3453 | 'form_success_color', |
| 3454 | array( |
| 3455 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3456 | 'type' => Controls_Manager::COLOR, |
| 3457 | 'selectors' => array( |
| 3458 | $this->selector( '-message--success' ) => 'color: {{VALUE}};', |
| 3459 | ), |
| 3460 | ) |
| 3461 | ); |
| 3462 | $this->add_control( |
| 3463 | 'form_success_bg_color', |
| 3464 | array( |
| 3465 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3466 | 'type' => Controls_Manager::COLOR, |
| 3467 | 'selectors' => array( |
| 3468 | $this->selector( '-message--success' ) => 'background-color: {{VALUE}};', |
| 3469 | ), |
| 3470 | ) |
| 3471 | ); |
| 3472 | |
| 3473 | $this->add_border( |
| 3474 | $this, |
| 3475 | 'form_success_border', |
| 3476 | $this->selector( '-message--success' ) |
| 3477 | ); |
| 3478 | |
| 3479 | $this->add_control( |
| 3480 | 'form_messages__error_heading', |
| 3481 | array( |
| 3482 | 'label' => __( 'Success Message', 'jet-form-builder' ), |
| 3483 | 'type' => Controls_Manager::HEADING, |
| 3484 | 'separator' => 'before', |
| 3485 | ) |
| 3486 | ); |
| 3487 | |
| 3488 | $this->end_controls_tab(); |
| 3489 | |
| 3490 | $this->start_controls_tab( |
| 3491 | 'messages_error_tab', |
| 3492 | array( |
| 3493 | 'label' => __( 'Error Message', 'jet-form-builder' ), |
| 3494 | ) |
| 3495 | ); |
| 3496 | |
| 3497 | $this->add_responsive_control( |
| 3498 | 'form_error_margin', |
| 3499 | array( |
| 3500 | 'label' => __( 'Margin', 'jet-form-builder' ), |
| 3501 | 'type' => Controls_Manager::DIMENSIONS, |
| 3502 | 'size_units' => array( 'px' ), |
| 3503 | 'selectors' => array( |
| 3504 | $this->selector( '-message--error' ) => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3505 | ), |
| 3506 | ) |
| 3507 | ); |
| 3508 | |
| 3509 | $this->add_responsive_control( |
| 3510 | 'form_error_padding', |
| 3511 | array( |
| 3512 | 'label' => __( 'Padding', 'jet-form-builder' ), |
| 3513 | 'type' => Controls_Manager::DIMENSIONS, |
| 3514 | 'size_units' => array( 'px' ), |
| 3515 | 'selectors' => array( |
| 3516 | $this->selector( '-message--error' ) => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3517 | ), |
| 3518 | ) |
| 3519 | ); |
| 3520 | |
| 3521 | $this->add_responsive_control( |
| 3522 | 'form_error_alignment', |
| 3523 | array( |
| 3524 | 'label' => __( 'Alignment', 'jet-form-builder' ), |
| 3525 | 'type' => Controls_Manager::CHOOSE, |
| 3526 | 'label_block' => false, |
| 3527 | 'default' => 'center', |
| 3528 | 'separator' => 'before', |
| 3529 | 'options' => array( |
| 3530 | 'left' => array( |
| 3531 | 'title' => __( 'Left', 'jet-form-builder' ), |
| 3532 | 'icon' => 'eicon-h-align-left', |
| 3533 | ), |
| 3534 | 'center' => array( |
| 3535 | 'title' => __( 'Center', 'jet-form-builder' ), |
| 3536 | 'icon' => 'eicon-h-align-center', |
| 3537 | ), |
| 3538 | 'right' => array( |
| 3539 | 'title' => __( 'Right', 'jet-form-builder' ), |
| 3540 | 'icon' => 'eicon-h-align-right', |
| 3541 | ), |
| 3542 | ), |
| 3543 | 'selectors' => array( |
| 3544 | $this->selector( '-message--error' ) => 'text-align: {{VALUE}};', |
| 3545 | ), |
| 3546 | ) |
| 3547 | ); |
| 3548 | |
| 3549 | $this->add_group_control( |
| 3550 | Group_Control_Typography::get_type(), |
| 3551 | array( |
| 3552 | 'name' => 'form_error_typography', |
| 3553 | 'selector' => $this->selector( '-message--error' ), |
| 3554 | ) |
| 3555 | ); |
| 3556 | |
| 3557 | $this->add_control( |
| 3558 | 'form_error_color', |
| 3559 | array( |
| 3560 | 'label' => __( 'Color', 'jet-form-builder' ), |
| 3561 | 'type' => Controls_Manager::COLOR, |
| 3562 | 'selectors' => array( |
| 3563 | $this->selector( '-message--error' ) => 'color: {{VALUE}};', |
| 3564 | ), |
| 3565 | ) |
| 3566 | ); |
| 3567 | $this->add_control( |
| 3568 | 'form_error_bg_color', |
| 3569 | array( |
| 3570 | 'label' => __( 'Background Color', 'jet-form-builder' ), |
| 3571 | 'type' => Controls_Manager::COLOR, |
| 3572 | 'selectors' => array( |
| 3573 | $this->selector( '-message--error' ) => 'background-color: {{VALUE}};', |
| 3574 | ), |
| 3575 | ) |
| 3576 | ); |
| 3577 | |
| 3578 | $this->add_border( |
| 3579 | $this, |
| 3580 | 'form_error_border', |
| 3581 | $this->selector( '-message--error' ) |
| 3582 | ); |
| 3583 | |
| 3584 | $this->end_controls_tab(); |
| 3585 | $this->end_controls_tabs(); |
| 3586 | $this->end_controls_section(); |
| 3587 | }; |
| 3588 | $closure(); |
| 3589 | } |
| 3590 | |
| 3591 | private function add_border( $instance, $control_id, $selector ) { |
| 3592 | $instance->add_group_control( |
| 3593 | Group_Control_Border::get_type(), |
| 3594 | array( |
| 3595 | 'name' => $control_id, |
| 3596 | 'label' => __( 'Border', 'jet-form-builder' ), |
| 3597 | 'placeholder' => '1px', |
| 3598 | 'selector' => $selector, |
| 3599 | ) |
| 3600 | ); |
| 3601 | $instance->add_responsive_control( |
| 3602 | $control_id . '_radius', |
| 3603 | array( |
| 3604 | 'label' => __( 'Border Radius', 'jet-form-builder' ), |
| 3605 | 'type' => Controls_Manager::DIMENSIONS, |
| 3606 | 'size_units' => array( 'px', '%' ), |
| 3607 | 'selectors' => array( |
| 3608 | $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 3609 | ), |
| 3610 | ) |
| 3611 | ); |
| 3612 | } |
| 3613 | |
| 3614 | /** |
| 3615 | * Render the widget output on the frontend. |
| 3616 | * |
| 3617 | * Written in PHP and used to generate the final HTML. |
| 3618 | * |
| 3619 | * @since 1.1.0 |
| 3620 | * |
| 3621 | * @access protected |
| 3622 | */ |
| 3623 | protected function render() { |
| 3624 | $settings = $this->get_settings_for_display(); |
| 3625 | |
| 3626 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 3627 | echo jet_fb_render_form( $settings ); |
| 3628 | } |
| 3629 | |
| 3630 | |
| 3631 | } |
| 3632 |