Skip to content
Snippets Groups Projects

Devel

Merged Krzysztof Dyszczyk requested to merge devel into master
2 files
+ 12
8
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 8
8
@@ -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']
Loading