Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

FR: Publishing Event #2520

Open
stvnthomas opened this issue May 27, 2020 · 1 comment
Open

FR: Publishing Event #2520

stvnthomas opened this issue May 27, 2020 · 1 comment

Comments

@stvnthomas
Copy link

I know you guys are hard at work on v3 but please consider this feature.

Is your feature request related to a problem? Please describe.
We've found that there are a lot of situations with collections where more control over the auto-generated slugs is warranted, either because there's a lot of title/naming duplication or because routing is unneccesary.

A recent example, a client needed a calendar to display events. No routing or entry view, just list the entry on the calendar. This was done with a collection but the nature of the calendar has a lot of redundancy in the titles so there's an ongoing problem/complaint of duplicate slugs. For slugs that aren't used.

Another common problem is for collections with routable entries with a lot of title redundancy. We'd like to be able to adjust the slug to autoincrement or make the slugs unique from one another.

Describe the solution you'd like
Add a new event, Event::fire('cp.publishing', $this->request), to the begning of the publish() method in core/CP/Publish/Publisher.php. This is a simple one-liner that would allow addons a lot of flexibility to modify the request (before validation, so the modified data would still get validated) to produce the exact auto-generated slugs needed.

Describe alternatives you've considered
There are no other alternatives I can identify. Slug is a special fieldtype that cannot be overridden and it's behavior cannot be modified. There are no other events that can be hooked into during the saving process and before validation.

@jesseleite
Copy link
Member

jesseleite commented Jul 1, 2020

For the record, this kind of thing is coming in v3. Not sure about v2 though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants