assets
1 month ago
block-asset.php
1 year ago
block-parser.php
1 year ago
block-render.php
1 year ago
block-template.php
2 months ago
block-type.php
1 year ago
block.json
2 months ago
tools.php
1 year ago
block-template.php
70 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @var Jet_Form_Builder\Blocks\Render\Base $this |
| 4 | * @var array $args |
| 5 | */ |
| 6 | |
| 7 | use Jet_Form_Builder\Classes\Tools; |
| 8 | |
| 9 | // If this file is called directly, abort. |
| 10 | if ( ! defined( 'WPINC' ) ) { |
| 11 | die; |
| 12 | } |
| 13 | |
| 14 | $name = $args['name'] ?? ''; |
| 15 | |
| 16 | $this->add_attribute( 'type', 'hidden' ); |
| 17 | $this->add_attribute( 'name', $this->block_type->get_field_name() ); |
| 18 | $this->add_attribute( 'data-field-name', $args['name'] ?? '' ); |
| 19 | $this->add_attribute( |
| 20 | 'data-settings', |
| 21 | Tools::esc_attr( $this->block_type->get_field_settings() ) |
| 22 | ); |
| 23 | $this->add_attribute( 'required', $this->block_type->get_required_val() ); |
| 24 | $this->add_attribute( 'value', $args['default']['self'] ?? '' ); |
| 25 | $this->add_attribute( 'class', 'jet-form-builder__field' ); |
| 26 | $this->add_attribute( 'class', $args['class_name'] ); |
| 27 | $this->add_attribute( 'data-jfb-sync' ); |
| 28 | ?> |
| 29 | <div class="jet-fb-map-field"> |
| 30 | <div class="jet-fb-map-field__preview"> |
| 31 | <address class="jet-fb-map-field__position"></address> |
| 32 | <div class="jet-fb-map-field__reset" role="button"> |
| 33 | × <?php echo esc_html__( 'Reset location', 'jet-form-builder' ); ?></div> |
| 34 | </div> |
| 35 | <?php if ( $this->block_type->get_repeater_name() ) : ?> |
| 36 | <div class="jet-fb-map-field__description"> |
| 37 | <p><strong><?php echo esc_html__( 'Lat and Lng are separately stored in the following fields', 'jet-form-builder' ); ?>:</strong> <i><?php echo esc_html( $args['name'] ); ?>_lat, <?php echo esc_html( $args['name'] ); ?>_lng</i></p> |
| 38 | </div> |
| 39 | <?php endif; ?> |
| 40 | <?php if ( ! empty( $args['autocomplete'] ) ) : ?> |
| 41 | <?php wp_enqueue_script( 'jet-fb-compat-jet-engine-map-field-autocomplete' ); ?> |
| 42 | <?php wp_enqueue_style( 'jet-fb-compat-jet-engine-map-field-autocomplete' ); ?> |
| 43 | <div class="jet-fb-map-field__search"> |
| 44 | <input type="text" placeholder="<?php esc_html_e( 'Search...', 'jet-form-builder' ); ?>"> |
| 45 | <div class="jet-fb-map-field__search-loader"></div> |
| 46 | <ul class="jet-fb-map-field__search-list"></ul> |
| 47 | </div> |
| 48 | <?php endif; ?> |
| 49 | <div class="jet-fb-map-field__frame" style="height: <?php echo absint( $args['height'] ?? 300 ) . 'px'; ?>"></div> |
| 50 | <input <?php $this->render_attributes_string(); ?> /> |
| 51 | <input |
| 52 | type="hidden" |
| 53 | name="<?php echo esc_attr( $this->block_type->get_field_name( $name . '_lat' ) ); ?>" |
| 54 | value="<?php echo esc_attr( $args['default']['lat'] ?? '' ); ?>" |
| 55 | data-map-field="lat" |
| 56 | /> |
| 57 | <input |
| 58 | type="hidden" |
| 59 | name="<?php echo esc_attr( $this->block_type->get_field_name( $name . '_lng' ) ); ?>" |
| 60 | value="<?php echo esc_attr( $args['default']['lng'] ?? '' ); ?>" |
| 61 | data-map-field="lng" |
| 62 | /> |
| 63 | <input |
| 64 | type="hidden" |
| 65 | name="<?php echo esc_attr( $this->block_type->get_field_name( $name . '_hash' ) ); ?>" |
| 66 | data-map-field="hash" |
| 67 | /> |
| 68 | </div> |
| 69 | <?php |
| 70 |