Problem/Motivation
Currently this module uses a textfield to represent the machine name, and uses the form validation function to ensure that the target entity type machine name doesn't already exist. The MachineName form element used by entity type creation forms does a little more then that though. It also ensures that the machine names only contain certain characters. As it's setup right now, the module will allow machine names that contain invalid characters. This prevents you from updating the entity in the future, since it will no longer save via the admin edit screen for the entity type. I'm marking it as Critical because if you don't catch it before content authors create content using that type, the only way to correct it is via database scripts or deleting the entity type and recreating all the content.
Steps to reproduce
I'll use a paragraph as an example, but it works with any entity.
- Clone an existing paragraph with a machine name of "invalid-machine-name".
- Navigate to /admin/structure/paragraphs_type/invalid-machine-name
- Update something on that page, such as the description
- Click Save.
The form will generate an error of "The machine-readable name must contain only lowercase letters, numbers, and underscores. "
Proposed resolution
Change the clone_bundle_machine form element from a textfield to a machine_name element, which takes care of all the validation for you. Attached patch does that.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | interdiff_1-5.txt | 5.35 KB | sourabhjain |
| #5 | 3208484-5.patch | 2.73 KB | sourabhjain |
| entity_type_clone-switch-to-machine_name-form-element.patch | 2.93 KB | jacobbell84 |
Comments
Comment #2
vuilComment #3
lukusI can confirm this issue.
Comment #4
vuilComment #5
sourabhjainI have rerolled the patch. Please review.
Comment #6
vuilComment #8
vuil