While creating a new entity with a number field /admin/structure/types/manage/task/fields/node.task.field_points
saving the field gives

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'form_validate_number' not found or invalid function name in Drupal\Core\Form\FormValidator->doValidateForm() (line 266 of core/lib/Drupal/Core/Form/FormValidator.php).

This seemed to be missed through #2326891: Convert system_element_info() to Element classes

This needs something like

+      '#element_validate' => array(
+        array($class, 'validateColor'),
+      ),

git diff 9c537ec4b20c4416c9b0265c1eeeb1d90ca0952a..9db4af56dae753528a2ffb721fed9d51e11f05b2

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

clemens.tolboom’s picture

removed double line.

swentel’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Right, stupid error. Let's add a simple test so we don't break this again.

clemens.tolboom’s picture

@swentel do you have some hints for a test?

swentel’s picture

I would look at the testNumberFormatter() method in NumberFieldTest.php- that is testing the display settings in field ui.
We can easily go to the manage fields screen there first too and fill in 'bad' values and make sure the validation happens.

swentel’s picture

swentel’s picture

swentel’s picture

Status: Needs work » Closed (duplicate)

So yeah, that's the right fix over there.