Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There's a minor glitch when adding a new field and changing the machine name...
1) Enter a 'Label' in the 'Add new field' row.
2) Edit the automatically generated machine name.
3) Drag the 'Add new field' row to another location.
The machine name disappears! It does save properly, but before that you can't see what you entered or edit it again.
A workaround is to move the field before editing the machine name. But users shouldn't be expected to know that.
Comments
Comment #2
walangitan CreditAttribution: walangitan at Chromatic commentedThis patch moves the hide function on the wrapper of of the input field into the conditional for that field to being empty. The assumption that is made is that the field will always be empty until the javascript starts to copy values into it from the transliterated field. Before, it hidden by default and my understanding is that dragging the element reset it to the default behavior. This patch should resolve that behavior.
Comment #3
walangitan CreditAttribution: walangitan at Chromatic commentedComment #4
SeanA CreditAttribution: SeanA commentedIt works, after editing the field doesn't disappear when dragging. However, if you then try to save the new field without selecting a type or widget, when the page reloads with the form error, the machine name preview and edit link appears again.
Comment #5
SeanA CreditAttribution: SeanA commentedThis patch moves the preview and edit link into the conditional statement as well, so they won't show if the machine name has already been edited.
Comment #6
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedIt is possible that this is a duplicate of this issue: #1700210: After editing a field machine name, then re-ordering the field, machine name field disappears? In that issue the approach used in D8 seems to be a lot easier.
Comment #7
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedUpdating this issue as backport of the #1700210: After editing a field machine name, then re-ordering the field, machine name field disappears
Comment #8
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedI think that the patch from the #5 of the parent issue should be better, because it is really simple and should fix the problem (according to my testing). Please test the patch, we do not have tabledrag JS tests in D7.
Comment #9
mcdruidI tested this manually and can confirm the bug and the backported fix in #8.
Thanks for the clear steps to reproduce, and for tidying up the loose ends with the backport.
Comment #11
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedThanks all!