diff --git a/changelog.txt b/changelog.txt index c0cdfc743ba86d2c30904c25a2cb210f626ec552..167c5b781acd7011e139a14e479b8fb81846aa55 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ # Changelog +## [2.4.12] - 2021-12-22 +### Fixed +- Fixed image input JS + ## [2.4.11] - 2021-12-03 ### Added - Added date input field diff --git a/templates/input-image.php b/templates/input-image.php index ce099e45930db93421a05db736286b4ddf9f7b47..854ca887f16f780ba599d092fac26d76955129bd 100644 --- a/templates/input-image.php +++ b/templates/input-image.php @@ -7,10 +7,10 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() ); ?> -<div class="media-input-wrapper" id="<?php echo \esc_attr( $media_container_id ); ?>"> +<div class="media-input-wrapper" id="<?php echo esc_attr( $media_container_id ); ?>"> <input type="hidden" class="image-field-value" value="<?php echo \esc_html( $value ); ?>" - name="<?php echo \esc_attr( $name_prefix ) . '[' . \esc_attr( $field->get_name() ) . ']'; ?>" - id="<?php echo \esc_attr( $field->get_id() ); ?>"/> + name="<?php echo esc_attr( $name_prefix ) . '[' . esc_attr( $field->get_name() ) . ']'; ?>" + id="<?php echo esc_attr( $field->get_id() ); ?>"/> <div class="custom-img-container"> <?php if ( $value ) : ?> <img src="<?php echo \esc_url( $value ); ?>" alt="" width="100"/> @@ -22,21 +22,21 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() ); if ( $value ) : ?> hidden<?php endif ?>" href="<?php echo \esc_url( $value ); ?>"> - <?php \esc_html_e( 'Set image', 'wp-forms' ); ?> + <?php esc_html_e( 'Set image', 'wp-forms' ); ?> </a> <a class="delete-custom-img <?php if ( ! $value ) : ?> hidden<?php endif ?>" href="#"> - <?php \esc_html_e( 'Remove image', 'wp-forms' ); ?> + <?php esc_html_e( 'Remove image', 'wp-forms' ); ?> </a> </p> </div> <script> jQuery( function ( $ ) { var frame, - metaBox = $( '#<?php echo \esc_attr( $media_container_id ); ?>' ), + metaBox = $( '#<?php echo esc_attr( $media_container_id ); ?>' ), addImgLink = metaBox.find( '.upload-custom-img' ), delImgLink = metaBox.find( '.delete-custom-img' ), imgContainer = metaBox.find( '.custom-img-container' ), @@ -50,9 +50,9 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() ); } frame = wp.media( { - title: <?php esc_html_e( 'Select or Upload Media', 'wp-forms' ); ?>, + title: "<?php esc_html_e( 'Select or Upload Media', 'wp-forms' ); ?>", button: { - text: <?php esc_html_e( 'Use this media', 'wp-forms' ); ?> + text: "<?php esc_html_e( 'Use this media', 'wp-forms' ); ?>" }, library: { type: ['image']