Skip to content

Commit fea871b

Browse files
authored
Merge pull request #96 from sabbir1991/master
Number field does not rendering min, max and step attribute fixed #95
2 parents 11a1685 + 92411c6 commit fea871b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/class.settings-api.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ function callback_number( $args ) {
204204
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
205205
$type = isset( $args['type'] ) ? $args['type'] : 'number';
206206
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
207-
$min = empty( $args['min'] ) ? '' : ' min="' . $args['min'] . '"';
208-
$max = empty( $args['max'] ) ? '' : ' max="' . $args['max'] . '"';
209-
$step = empty( $args['max'] ) ? '' : ' step="' . $args['step'] . '"';
207+
$min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';
208+
$max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';
209+
$step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
210210

211211
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
212212
$html .= $this->get_field_description( $args );
@@ -566,15 +566,15 @@ function script() {
566566
if (typeof(localStorage) != 'undefined' ) {
567567
activetab = localStorage.getItem("activetab");
568568
}
569-
569+
570570
//if url has section id as hash then set it as active or override the current local storage value
571571
if(window.location.hash){
572572
activetab = window.location.hash;
573573
if (typeof(localStorage) != 'undefined' ) {
574574
localStorage.setItem("activetab", activetab);
575-
}
576-
}
577-
575+
}
576+
}
577+
578578
if (activetab != '' && $(activetab).length ) {
579579
$(activetab).fadeIn();
580580
} else {

0 commit comments

Comments
 (0)