DO NOT MERGE | new calendar endpoints#831
DO NOT MERGE | new calendar endpoints#831carstingaxion wants to merge 65 commits intoGatherPress:developfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, I'm still a bit brain dead from being off for 2 weeks and trying to get back in the flow of things. I think the |
Preview changes with PlaygroundYou can preview the least recent changes for PR#831 by following one of the links below: |
|
Hello @mauteri , I've updated the PR description with more relevant info and fixed the simple errors. The remaining CS failures and Unit test failures are kind of intentional, to remind us what needs attention. I will now not be able to add some helping review comments, but open it up for Reviews anyway. |
|
I'm going to start adding some review-comments for you now @mauteri. Would be cool, if you find the time (or someone else) to go trough all of this me...melange. |
There was a problem hiding this comment.
@mauteri I added 16 comments to help navigate to the most problematic parts.
|
Does this provide a general event feed, listing all events fit the site in iCal e.g. example.org/events/feed/ical/ ? And does this also support taxonomies ? e.g. example.org/events/feed/ical/topic/parents: Pete |
Original PR description
As a proof-of-concept PR, this code needs for sure some orchestration!
The used anonymous functions are my preferred way of experimenting, but not meant to stay.
I can see 3 different ways to go on:
class-add-to-calendar.phpclass-rewrite-api.phpthat handles all the rewrites stuff and is only used by the currentclass-event.phpclass-endpoints.php, that could also be the future home for Add subscribeable Ical feeds #603Following path number 2 could be interesting for the future, as it could be reused, if GatherPress would want to create
/ticketsor/qrendpoints on events, for example. Long time ago created a similar abstraction to route AJAX requests, because it was (maybe still is) usually around 10 times faster than the REST API.———
I’ve also tried using
add_rewrite_endpoint()in the first run, but this would have added the new endpoints to allEP_PERMALINKrewrites, which would have meant: all non-hierarchical post types. In that case, I would have had to set custom 404s on all non-event post types, which ended up being very tedious and a lot of additional code. That’s why I went withadd_rewrite_rule()which allows a restriction on one post type.Description of the Change
This PR add several new URL endpoints to events, one per each add-to-calendar link. The new endpoints are:
example.org/event/my-sample-event/icalexample.org/event/my-sample-event/iCal(Alias for/ical)example.org/event/my-sample-event/outlook(Alias for/ical)example.org/event/my-sample-event/googlecalendarexample.org/event/my-sample-event/yahoocalendarWith the original intention to help with #704, this PR also does some more subtle changes to the generated ics file, like changing its default line breaks.
Because this renders into a sites frontend output, this PR additionally introduces a way to overwrite the generated iCal via a theme template. This opens another way of extension and can be used to test this PR.
Can be stated as totally outdated!
Unfortunately, this PR does NOT help with #704,
but instead has grown from 193 to 2607 lines of code and now closes #603 instead.
An extensive description can be found in a new
/docs/developer/custom-url-endpointsarticle, that is also part of this PR.This PR introduces the following of new endpoints:
example.org/event/my-sample-event/icalprovides a download-able .ics file in ical format.
example.org/event/my-sample-event/outlookprovides the same download-able file as an alias.
example.org/event/my-sample-event/google-calendarredirects to create a new event in Google Calendar.
example.org/event/my-sample-event/yahoo-calendarredirects to create a new event in Yahoo Calendar.
example.org/event/feed/icalprovides a subscribe-able event feed in ical format with all events of the site.
example.org/venue/my-sample-venue/feed/icalprovides a subscribe-able event feed in ical format with all events at that venue.
example.org/topic/my-sample-topic/feed/icalprovides a subscribe-able event feed in ical format with all events grouped into that topic.
How to test the Change
echo ‚hello themed iCal world‘;into itChangelog Entry
Credits
Props @carstingaxion
Checklist:
/readme.md/docs/contributor/unit-tests/docs/developer/custom-url-endpoints/docs/developer/theme-customizationsRelated PRs that can be reviewed & merged after this:
To get the new endpoints into the block-editor, one of the following would be required:
OR