Skip to content

Commit

Permalink
GetDKAN#4068: Provide number widget - Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-korn committed Apr 24, 2024
1 parent 4a30104 commit 71c5e6a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/json_form_widget/src/WidgetRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,18 @@ public function handleDateRangeElement($spec, array $element) {
/**
* Helper function for getting a number element.
*
* @param mixed $spec
* Object with spec for UI options.
* optional specs
* - step
* - min
* - max
* @param object $spec
* Specification for UI options. Optional properties:
* - step: Ensures that the number is an even multiple of step
* - min: Minimum value
* - max: Maximum value
* @param array $element
* Element to convert into number.
*
* @return array
* The element configured as number.
*
* @see \Drupal\Core\Render\Element\Number
*/
public function handleNumberElement($spec, array $element) {
$element['#type'] = 'number';
Expand All @@ -434,7 +435,7 @@ public function handleNumberElement($spec, array $element) {
if (isset($spec->min)) {
$element['#min'] = $spec->min;
}
if (isset($spec->step)) {
if (isset($spec->max)) {
$element['#max'] = $spec->max;
}
return $element;
Expand Down

0 comments on commit 71c5e6a

Please sign in to comment.