- Issue created by @jrockowitz
- Merge request !7339Issue #3438739: The calculated machine is not synced when the source value is... β (Open) created by jrockowitz
- πΊπΈUnited States jrockowitz Brooklyn, NY
I created an MR. I don't do any core development, so forgive me if I do something wrong.
The fix could be as simple as looking at the initial machine name and not the calculated machine name.
In 10.1.x, the code worked because the machine was being calculated via transliterate Ajax request which would set the target value after the event handler was initialized.
https://git.drupalcode.org/project/drupal/-/blob/10.2.x/core/misc/machin...
https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/misc/machin...I hope this helps.
- Status changed to Needs work
12 months ago 8:39am 7 June 2024 - πΊπΈUnited States xjm
Thanks @jrockowitz! The only thing is that we need the MR to be created against 11.x, since issues are committed there first and then backported. Trying to switch the target branch can get really messy, so sometimes it's best to close the previous MR and re-create it against 11.x with a cherry-pick or whatever.
This also seems like a bug that should get some FunctionalJS test coverage, if it's a JS bug.
Thanks!
- First commit to issue fork.
- πΊπΈUnited States dcam
I added an assertion to
MachineNameTest
in a new D11 branch. I haven't added the fix created by @jrockowitz yet. That new assertion failed as expected. I'll commit the fix and see what happens. - πΊπΈUnited States dcam
Added info to the steps to reproduce. This is reproducible out-of-the-box with one of core's testing modules.
- πΊπΈUnited States smustgrave
Manually tested this following the steps.
Went to /form-test/machine-name
Changed the label and machine name did not change
Applying the MR and repeating
The machine name is changingSummary seems to match the solution and has test coverage.
LGTM
- Status changed to Closed: works as designed
15 days ago 2:52pm 16 May 2025 - π«π·France nod_ Lille
This is a feature, not a bug.
Check out the 3 lines of comments just before the code change:
// Preview the machine name in realtime when the human-readable name
// changes, but only if there is no machine name yet; i.e., only upon
// initial creation, not when editing.You want to be able to change the label without changing the machine name. Happens all the time that some vocabulary is renamed to be clearer to end-users but you want to keep the machine name to not mess with config export and custom code.