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.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Niklas Fiekas’s picture

Status: Active » Needs review
FileSize
6.4 KB

First try.

Status: Needs review » Needs work

The last submitted patch, 1519720-use-number-1.patch, failed testing.

Niklas Fiekas’s picture

Status: Needs work » Needs review
FileSize
1.58 KB
7.45 KB

Ok, 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.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

Dave Reid’s picture

I love this cleanup!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Nice clean-up indeed. Better developer experience. Committed to 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

marcingy’s picture

Title: Remove element_validate_integer() and element_validate_integer_positive() in favor of the new number element type » Change notification : Remove element_validate_integer() and element_validate_integer_positive() replace with number element type
Priority: Normal » Critical
Status: Closed (fixed) » Active

Re-opening as this needs a change notification

Niklas Fiekas’s picture

Title: Change notification : Remove element_validate_integer() and element_validate_integer_positive() replace with number element type » Remove element_validate_integer() and element_validate_integer_positive() replace with number element type
Priority: Critical » Normal
Status: Active » Fixed

Well spotted. Fixed: http://drupal.org/node/1678914.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Fix typo.