Closed ausi closed 5 years ago
You don't need to get the adapter for the StringUtil
class. It's not wrong to use a class statically as long as it has no external dependencies. So StringUtil::prepareSlug($text)
is perfectly fine. And the rest of your proposal looks good to me 👍
Are we generating the slug from multiple places? Or is this just used to generate the slug for a page alias? Then maybe we should simply implement that in an event listener instead of a generic slug service?
Closed in favor of contao/contao#222
Related: #1598
As @Toflar noted in https://github.com/contao/core-bundle/commit/7d2daad52af73471ba717336529f2b601fd1d8eb#r30056164 we should probably create a service for generating aliases. IMO this could look like so:
and can be used like so:
Does this make sense?
How should we name this service?
(In this context we should IMO also change the
is_numeric()
checks to a RegEx check `/^[1-9][0-9]$/`)*