v2-hub icon indicating copy to clipboard operation
v2-hub copied to clipboard

FR: Publishing Event

Open stvnthomas opened this issue 4 years ago • 1 comments

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.

stvnthomas avatar May 27 '20 21:05 stvnthomas

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

jesseleite avatar Jul 01 '20 18:07 jesseleite