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

Merge branch 'master' into 'feature/strong-typing'

# Conflicts:
#   changelog.txt
parents 9defbea6 3a8da7d7
No related branches found
No related tags found
2 merge requests!28release: 3.0.0,!19Add strong typing for 3.0 version
Pipeline #6823 passed with stages
in 2 minutes and 38 seconds
# Changelog # Changelog
## [2.4.11] ## [2.4.12] - 2021-12-22
### Changed ### Fixed
- Allow TextFieldSanitizer to process array values - Fixed image input JS
## [2.4.11] - 2021-12-03
### Added
- Added date input field
## [2.4.10] - 2021-10-01 ## [2.4.10] - 2021-10-01
### Changed ### Changed
......
<?php
namespace WPDesk\Forms\Field;
use WPDesk\Forms\Sanitizer\TextFieldSanitizer;
class DateField extends BasicField {
public function __construct() {
parent::__construct();
$this->set_placeholder('YYYY-MM-DD');
}
public function get_type() {
return 'date';
}
public function get_template_name() {
return 'input-text';
}
}
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
$media_container_id = 'media_' . sanitize_key( $field->get_id() ); $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 ); ?>" <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() ) . ']'; ?>" name="<?php echo esc_attr( $name_prefix ) . '[' . esc_attr( $field->get_name() ) . ']'; ?>"
id="<?php echo \esc_attr( $field->get_id() ); ?>"/> id="<?php echo esc_attr( $field->get_id() ); ?>"/>
<div class="custom-img-container"> <div class="custom-img-container">
<?php if ( $value ) : ?> <?php if ( $value ) : ?>
<img src="<?php echo \esc_url( $value ); ?>" alt="" width="100"/> <img src="<?php echo \esc_url( $value ); ?>" alt="" width="100"/>
...@@ -22,21 +22,21 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() ); ...@@ -22,21 +22,21 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() );
if ( $value ) : if ( $value ) :
?> ?>
hidden<?php endif ?>" href="<?php echo \esc_url( $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>
<a class="delete-custom-img <a class="delete-custom-img
<?php <?php
if ( ! $value ) : if ( ! $value ) :
?> ?>
hidden<?php endif ?>" href="#"> hidden<?php endif ?>" href="#">
<?php \esc_html_e( 'Remove image', 'wp-forms' ); ?> <?php esc_html_e( 'Remove image', 'wp-forms' ); ?>
</a> </a>
</p> </p>
</div> </div>
<script> <script>
jQuery( function ( $ ) { jQuery( function ( $ ) {
var frame, var frame,
metaBox = $( '#<?php echo \esc_attr( $media_container_id ); ?>' ), metaBox = $( '#<?php echo esc_attr( $media_container_id ); ?>' ),
addImgLink = metaBox.find( '.upload-custom-img' ), addImgLink = metaBox.find( '.upload-custom-img' ),
delImgLink = metaBox.find( '.delete-custom-img' ), delImgLink = metaBox.find( '.delete-custom-img' ),
imgContainer = metaBox.find( '.custom-img-container' ), imgContainer = metaBox.find( '.custom-img-container' ),
...@@ -50,9 +50,9 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() ); ...@@ -50,9 +50,9 @@ $media_container_id = 'media_' . sanitize_key( $field->get_id() );
} }
frame = wp.media( { 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: { button: {
text: <?php esc_html_e( 'Use this media', 'wp-forms' ); ?> text: "<?php esc_html_e( 'Use this media', 'wp-forms' ); ?>"
}, },
library: { library: {
type: ['image'] 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