I have my slug saving to the element_i18n table but it's not unique. When saving a non-unique slug using the default Craft entries, the slug gets appended with "-1".

How can I extend the default functionality for a slug?

2 Answers 2


Brad, I realize my initial question is a bit vague, oops! I did however find a solution to why my localized slugs for my plugin element weren't being saved as a unique string.

I traced through ElementHelper::setUniqueUri() and figured out I was missing the getUrlFormat() function. Also to make sure I include {slug} in my urlFormat string in this particular case.


A bit hard to tell what you're trying to do from the description and without seeing some code examples, but internally Craft uses ElementHelper::setValidSlug() and ElementHelper::setUniqueUri() to perform those tasks.

Whether you need to use them directly or call a Craft method that uses them is hard to say without more context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.