[5.x]: Unable to change field handle for a global field
Open
Nobody has claimed this yet.
bug
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
When I add an existing field to a global, I am unable to change the fieldHandle.
Steps to reproduce
- Take an existing field, in my case is an asset field, and drag it into the field layout within a globals section.
- Save that globals section, successfully.
- Click the "..." next to that asset field and give it a new contentHandle. (It doesn't matter what you change it to)
- Click "Apply"... looks successful
- Click Save on the global page.
- Met with InvalidFieldException
Expected behavior
This should give the instance of the field the desired name, as it does correctly in Entry Types.
Actual behavior
Throws above exception.
Craft CMS version
5.6.12
PHP version
8.2.18
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in Craft CMS 5.6.12 by adding an existing asset field to a globals section, changing its contentHandle, and saving the global. Start from the resulting InvalidFieldException and trace the global field-save path. Done means the field instance accepts the changed handle and the globals section saves successfully, as it does for entry types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100