Skip to content

Commit fd24f67

Browse files
committed
Fix handling of starting value
1 parent 95b2084 commit fd24f67

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

projects/packages/forms/src/contact-form/class-contact-form-field.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public function __construct( $attributes, $content = null, $form = null ) {
145145
'optionstyles' => null,
146146
'min' => null,
147147
'max' => null,
148+
'startingvalue' => null,
148149
'maxfiles' => null,
149150
'fieldwrapperclasses' => null,
150151
'stylevariationattributes' => array(),
@@ -483,6 +484,9 @@ public function render() {
483484
if ( is_numeric( $this->get_attribute( 'max' ) ) ) {
484485
$extra_attrs['max'] = $this->get_attribute( 'max' );
485486
}
487+
if ( is_numeric( $this->get_attribute( 'startingvalue' ) ) ) {
488+
$extra_attrs['startingvalue'] = $this->get_attribute( 'startingvalue' );
489+
}
486490
}
487491

488492
$rendered_field = $this->render_field( $field_type, $field_id, $field_label, $field_value, $field_class, $field_placeholder, $field_required, $field_required_text, $extra_attrs );
@@ -2202,7 +2206,7 @@ public function render_slider_field( $id, $label, $value, $class, $required, $re
22022206
}
22032207
$min = isset( $extra_attrs['min'] ) ? $extra_attrs['min'] : 0;
22042208
$max = isset( $extra_attrs['max'] ) ? $extra_attrs['max'] : 100;
2205-
$starting_value = isset( $extra_attrs['startingValue'] ) ? $extra_attrs['startingValue'] : 50;
2209+
$starting_value = isset( $extra_attrs['startingvalue'] ) ? $extra_attrs['startingvalue'] : 50;
22062210
$current_value = ( $value !== '' && $value !== null ) ? $value : $starting_value;
22072211

22082212
$field = $this->render_label( 'slider', $id, $label, $required, $required_field_text );

projects/packages/forms/src/contact-form/class-contact-form-plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3110,7 +3110,7 @@ public static function gutenblock_render_field_slider( $atts, $content, $block )
31103110
$attrs = $inner_block['attrs'] ?? array();
31113111
$atts['min'] = isset( $attrs['min'] ) && $attrs['min'] !== '' ? $attrs['min'] : 0;
31123112
$atts['max'] = isset( $attrs['max'] ) && $attrs['max'] !== '' ? $attrs['max'] : 100;
3113-
$atts['startingValue'] = isset( $attrs['startingValue'] ) && $attrs['startingValue'] !== '' ? $attrs['startingValue'] : 50;
3113+
$atts['startingvalue'] = isset( $attrs['startingValue'] ) && $attrs['startingValue'] !== '' ? $attrs['startingValue'] : 50;
31143114
}
31153115
}
31163116
}

0 commit comments

Comments
 (0)