The various 'settings form' for field settings, widget settings, formatter settings, frequently need basic validation rules like 'number', 'integer', 'positive integer'...
To avoid each field type module redefining those functions over and over, CCK D6 defined generic validator functions :
_element_validate_number(), _element_validate_integer(), _element_validate_integer_positive().
They stayed in Field UI during the D7 conversion - not in the .module, but in field_ui.admin.inc, not always loaded).
However, the forms that use those functions can appear outside of Field UI, and even when Field IU is disabled, e.g formatter settings when configuring field display in Views (#884730: Add new UI for formatter settings options to the field settings panel).
Attached patch moves them to field.module (arguably they could belong in form.inc, but I prefer to keep that door closed for now).
major, because this blocks the Views patch above (well, it redeclares the functions if they don't exist, but it's an ugly hack).
| Comment | File | Size | Author |
|---|---|---|---|
| field_validator_helpers.patch | 2.55 KB | yched |
Comments
Comment #1
wundo commentedJust tested your patch and it's working perfectly here, also this just reminds me of webchick's issue (http://drupal.org/node/937814) from last week talking about all those UI modules that are being made.
Comment #2
wundo commentedComment #3
effulgentsia commentedI agree with this being RTBC, but not with it being "critical". Anyway, a totally logical patch, and helping Views module and other modules avoid needless duplication is a wonderful thing.
Comment #5
yched commentedTest bot hiccup ? Patch is harmless, and the failed tests above pass on my local setup.
field_validator_helpers.patch queued for re-testing.
Comment #6
effulgentsia commentedBot seems happy again: http://qa.drupal.org/pifr/test/99489
Comment #7
dries commentedCommitted to CVS HEAD. Thanks.