Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow up. Now that we have #1174640: Add new HTML5 FAPI element: number it's time to use the new element type.
That is:
- Replace element_validate_integer() with
'#type' => 'number'
. Default step is 1, so nothing special for integers. - Replace element_validate_integer_positive() with
'#type' => 'number', '#min' => 1
. Default step is 1, so nothing special for integers. Negative numbers and zero are not allowed, so the minimum is 1.
Comment | File | Size | Author |
---|---|---|---|
#7 | 1519720-use-number-7.patch | 7.45 KB | Niklas Fiekas |
#7 | 1519720-use-number-7-interdiff.txt | 1.58 KB | Niklas Fiekas |
#1 | 1519720-use-number-1.patch | 6.4 KB | Niklas Fiekas |
Comments
Comment #1
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedFirst try.
Comment #7
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedOk, poll module tests caught the changed error messages. While fixing that I also found "custom" non-negative validation, that can be replaced with
'#min' => 0
.Comment #8
sunThanks!
Comment #9
Dave ReidI love this cleanup!
Comment #10
Dries CreditAttribution: Dries commentedNice clean-up indeed. Better developer experience. Committed to 8.x.
Comment #12
marcingy CreditAttribution: marcingy commentedRe-opening as this needs a change notification
Comment #13
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedWell spotted. Fixed: http://drupal.org/node/1678914.
Comment #14.0
(not verified) CreditAttribution: commentedFix typo.