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