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.
On testing the d8 port I recognized that there is currently the field name used as default field value.
I didn't know if we really need a default value on a field which is hardcoded to be unique. On the field settings form there is currently displayed an information about default value but no text field to fill. Maybe this is combined problem.
Comment | File | Size | Author |
---|---|---|---|
#18 | machine_name-empty_source-2832150-18.diff | 370 bytes | svetoslav.dragoev |
#9 | machine_name-empty_source-2832150-9.diff | 515 bytes | Dmitriy.trt |
| |||
#2 | mn1 settings for Article - Site-Install 2.12.2016, 17-21-19.png | 31.36 KB | C-Logemann |
Issue fork machine_name-2832150
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
C-LogemannAdded a screenshot of field settings.
Comment #3
andypostyep, that's strange behaviour I guess better to allow use tokens to generate default value
Comment #4
dksdev01 CreditAttribution: dksdev01 commentedtaking over this issue to have a stable release for 8.x and 9.x
Comment #5
C-Logemann@dksdev01 Any progress on this issue? If you need help just ask. And if you don't have time please unassign yourself.
Comment #6
dksdev01 CreditAttribution: dksdev01 commentedComment #9
Dmitriy.trt CreditAttribution: Dmitriy.trt at FFW commentedCreated MR!1 with a quick fix. Machine name form element attaches to
label
input by default and it's the field name in this case. The fix is to stop it from doing so. It also affects actual entity forms, but I would really say it was a bug that module didn't handle it there too. First idea was to make the source configurable, but it doesn't work well. See #990218: Machine name field throws notices if before source field. and the way it was fixed. Since we can't guarantee the order in which widgets appear in the form structure, it doesn't look possible to control the source from the widget level. But it should still be possible to re-add the machine name to the form structure from ahook_form_alter()
implementation and guarantee the order of fields in the PHP array.The fix also doesn't update existing fields, that's up to site maintainers, I believe.
Attaching the diff for a stable reference from composer. It was made from MR!1 at commit
b98412fd
.Comment #11
_shYReviewed and tested the merge request !1, looks fine.
Also, updated the commit according to the last branch changes.
Comment #12
C-Logemann@_shY Please don't mark your own code contributions by yourself as RTBC.
Comment #13
abrammHi @C-Logemann, thanks for pointing on this!
@_shY is doing some work under my mentoring; we'd like to try adding some tests before merging the patches for the issues we currently have.
I'll keep an eye on this.
Comment #14
svetoslav.dragoev CreditAttribution: svetoslav.dragoev at FFW commentedRe-roll of patch #9 against latest release: dev-1.x 0805042.
Comment #15
svetoslav.dragoev CreditAttribution: svetoslav.dragoev at FFW commentedComment #16
svetoslav.dragoev CreditAttribution: svetoslav.dragoev at FFW commentedUnfortunately selected wrong file on first upload and updating it did not work, so uploading once again :) (use this one).
Comment #18
svetoslav.dragoev CreditAttribution: svetoslav.dragoev at FFW commented#16 contained wrong filename, correcting it. Patch is the same, just fixing it to not change the filename.