Skip to content
Snippets Groups Projects
Commit 3a8da7d7 authored by Piotr Po's avatar Piotr Po
Browse files

Merge branch 'devel' into 'master'

Devel

See merge request !26
parents a0696dc6 901cd64b
No related branches found
No related tags found
2 merge requests!26Devel,!19Add strong typing for 3.0 version
Pipeline #438012 failed with stages
in 6 seconds
# Changelog
## [2.4.12] - 2021-12-22
### Fixed
- Fixed image input JS
## [2.4.11] - 2021-12-03
### Added
- Added date input field
......
......@@ -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']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment