public static function Range::validateRange in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/Range.php \Drupal\webform\Plugin\WebformElement\Range::validateRange()
Form API callback. Make sure range element's default value is a string.
See also
\Drupal\Core\Render\Element\Range::valueCallback
File
- src/
Plugin/ WebformElement/ Range.php, line 239
Class
- Range
- Provides a 'range' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public static function validateRange(array &$element, FormStateInterface $form_state, array &$completed_form) {
$value = $element['#value'];
$value = $value === 0 ? '0' : (string) $value;
$form_state
->setValueForElement($element, $value);
}