Skip to content

[6.x] Entry type handle validation#18649

Open
AugustMiller wants to merge 4 commits into6.xfrom
bugfix/entry-type-handle-validation
Open

[6.x] Entry type handle validation#18649
AugustMiller wants to merge 4 commits into6.xfrom
bugfix/entry-type-handle-validation

Conversation

@AugustMiller
Copy link
Copy Markdown
Contributor

Placeholders were showing up in the handle validator on entry types; once that was fixed, the error was cryptic (like "“2” is not a valid handle.”), which led me to the second patch.

Checking $saveAsNew seemed appropriate before trying to increment the handle; if someone chooses an existing handle, we probably shouldn't quietly swallow the collision.


// If we're duplicating the entry type and the handle hasn't changed, find a unique one
if ($entryType->handle === ($originalEntryType->handle ?? null)) {
if ($saveAsNew && $entryType->handle === ($originalEntryType->handle ?? null)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is logic straight from 5.x: https://github.com/craftcms/cms/blob/5.x/src/controllers/EntryTypesController.php#L240

Do we need to change it there as well then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants