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.
By Niklas Fiekas on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
element_validate_integer() and element_validate_integer_positive() have been removed.
Before:
$form['count'] = array(
'#type' => 'textfield',
'#title' => t('Item count'),
'#description' => t('Enter a number of items'),
'#element_validate' => array('element_validate_integer_positive'),
);
After:
$form['count'] = array(
'#type' => 'number', // New HTML 5 number type.
'#title' => t('Item count'),
'#description' => t('Enter a number of items'),
'#min' => 0, // Use this to replace element_validate_integer_positive() validation.
// Having just #type => 'number'
// already replaces element_validate_integer().
);
See the number element change notification for more information about the new number element type.
Impacts:
Module developers