This project is not covered by Drupal’s security advisory policy.
Silently make fixes to incoming data (whether submitted by a form or migrated in) rather than triggering an error when the correction is unambiguous. TIDY also stands for Treat Inputters Decently Ya-durned-infernal-technology.
The grand vision is to be an example for a future "transform" layer in Drupal core that runs before validation, treating humans with the kindness and equality that most of us deserve, whether entering content or importing data.
Features
The Tidy module will quietly correct incomplete but unambiguously correctable URLs entered into Link fields
…rather than screaming at the user / API, throwing a fit, and refusing to submit the form or create the content, which is the current default behavior.
This is done by transforming "example.com" into "http://example.com". (It could be made to transform instead into "https://example.com"; this is more secure but more likely to cause a broken link for a website that could otherwise be reached. If you think there should be an option to use the more secure but still less supported https or even to test the URL and figure this automatically, or to add any new transformation to Tidy, please file an issue!
Post-Installation
In general, you should not have to do anything, and this module will start to make everybody's experience nicer when:
- Entering URLs with Drupal core's Link field— no
http://? No problem! We got you covered.
However, note that Drupal does not automatically run validation before saving entities. Text entered into content create and edit forms is always validated, but if your way of importing content does not take care to explicitly call validation, you will need to find another way to use this module (probably by using the Tamper plugin it provides. Drupal core's Migration API by default does not do validation when creating content entities. Feeds by default does do validation, but allows it to be disabled.
Additional Requirements
- Tamper. We chose to integrate with Tamper module to ensure our data-cleaner-uppers integrated with the ecosystem using Tamper (like ECA, Feeds, and Migrate) and to potentially make use of existing tamper plugins. Plus it's fun to say that we'll be tampering with your data validation.
Recommended modules/libraries
Similar projects
- Trim, although the problem of getting Trim to work for both humans entering content into a form and (presumably at some point humans) importing data via an API is part of what inspired this module.
Supporting this Module
You can support Agaric's overall contributions to Drupal and a bit beyond by supporting Drutopia at opencollective.com/drutopia. Thanks!!
Community Documentation
Volunteers for documentation welcome and treasured!
Philosophy
This module is the eventual result of asking the seemingly simple question of Drupal: "How to manipulate field/entity data before it is validated?" Pre-save is called automatically by save, so is always after validation, but as validate is left as an exercise to the implementer of saving, there is no consistent way to, say, trim or impose a format before validation. This is another barrier in treating API and form submissions the same.
This module tries to act as a "pre-validation" step, a data transform layer that is part of Drupal and can always be relied on no matter what the source of the data. Achieving this will require changes to Drupal core
A separate but related goal (would go in a different module / layer of core) is to provide "soft" validation where there is a standard way to warn people their content may be questionable in some way and suggest, but not require, fixing before submission.
Project information
- Project categories: Automation, Content editing experience, Import and export
- Ecosystem: Tamper
- Created by mlncn on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.


