Updated: Comment #0
Problem/Motivation
Machine names are by their nature unique, so they typically have validation to ensure a duplicate machine name does not already exist. However, when the machine name is auto-generated based on another field, the user might sometimes create a duplicate machine name without knowing the machine name field even exists. This causes a usability problem when the user is suddenly confronted with an error on a field they've never seen before.
For example, in the field UI:
- Install 8.x standard.
- Go to
admin/structure/types/manage/page/fields
. - Under "Add new field," type "tags" in the Label field and select a term reference field.
- You receive a validation error on a field you did not fill in.
Proposed resolution
Make the machine name element provide the option to automatically append a delta.
- #1998582: Auto-generate machine_name for Views Blocks using [viewname]_[displayname] rather than forcing manual entry does this by adding the delta to the default value. For more typical machine name fields, this would mean that the realtime machine name generation would need to query for existing machine names on each keystroke, which might not be ideal.
- Another option would be to append the delta on save.
Remaining tasks
- Choose an approach.
- Create patch.
- Update existing machine names in the block and field UIs to use the auto-delta.
- Remove the custom delta generation from the views block plugin.