new section - update uri (format) even if field hidden #13355
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Improves the UX of new section creation by updating the URI/URI format field based on the name, even if the URI/URI format field is hidden. This is achieved by adding the
updateWhenHidden
property to theBaseInputGenerator
settings. It’sfalse
by default resulting in the same behaviour as currently, but if set totrue
, even hidden inputs will be populated with the generated value.Previously, when you went to create a new section, and you filled out the name, the handle and URI got populated with the generated value. However, if you then changed the section type from channel or structure to single, the URI remained blank until you went on to save the section, at which point the URI got populated based on the section name and saved. You then had to edit the single section again and remove the URI if that’s what you wanted in the first place.
A similar logic applied the other way around too. If you went to create a new section, changed the type to single, and then filled out the name, the handle and URI were populated with the generated value. If you then changed the section type to channel or structure, the URI was blank and only populated on save.
Now, fields for the URI format for the new section get updated with the generated value even if the field is hidden, which means that the user sees the actual URI/URI format that will be saved and can adjust it without it being updated and overwritten on save.
Related issues
#13350