You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[4.x]: Disabling slug increment in the config does not prevent saving of and element with a non-unique slug / uri when saved in the CP, disabling instead.
#16243
Open
samhibberd opened this issue
Nov 29, 2024
· 0 comments
Setting the maxSlugIncrement slug to 1 is the suggested way to disable automatic slug increment feature(eg -1-2 up to the maximum value). Currently trying to save an element, with a non unique slug / uri, in the CP does not prevent save, instead it disables and appears to save successfully. Having discussed with Tommy from the support team, we agreed that we expected it to throw an error and prevent the save.
Saving programatically does not have this issue, with the caveat that the uri is only validated if the element is enabled, see:
What happened?
Description
Setting the
maxSlugIncrement
slug to1
is the suggested way to disable automatic slug increment feature(eg-1
-2
up to the maximum value). Currently trying to save an element, with a non unique slug / uri, in the CP does not prevent save, instead it disables and appears to save successfully. Having discussed with Tommy from the support team, we agreed that we expected it to throw an error and prevent the save.Saving programatically does not have this issue, with the caveat that the uri is only validated if the element is enabled, see:
cms/src/validators/ElementUriValidator.php
Lines 58 to 65 in 4ac4d02
I would have expected this to be handled by / respect the scenarios set on the validation rule, currently default, essential and live:
Steps to reproduce
my-test
Expected behavior
Could not generate a unique URI based on the URI format
or similar (eg slug / uri already taken)Actual behavior
my-test
and is disabledNB. Not checked if this also impacts [5.x]
Craft CMS version
4.12.5
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: