\EventsEvents

Events Plugin Events Class

The Events Class processes event: frontmatter and adds virtual Event pages to the Grav page stack depending on frequency and repeat rules. Each virtual page is assigned a new route using a static & unique 6 character token based off the existing page id and date.

PHP version 5.6+

Summary

Methods
Properties
Constants
__construct()
all()
No public properties found
No constants found
No protected methods found
$pages
$taxonomy
N/A
preprocessEventPages()
processRepeatingEvents()
processReoccuringEvents()
clonePage()
No private properties found
N/A

Properties

$pages

$pages : object

Type

object — Grav Pages

$taxonomy

$taxonomy : object

Type

object — Grav Taxonomy

Methods

__construct()

__construct() : void

Events Class Construct

Setup a pointer to pages and taxonomy for processing cloned event pages into Grav.

all()

all() : object

Process Event Pages

This is where the Events plugin processes events into new dynamic pages. There are 3 processing steps for updating $this->pages before returning it for use in the main plugin Events class.

STEP 1: Preprocess the Event

This processes all Grav pages for event: frontmatter and runs appropriate filters for adding the page to @taxonomy.type: event.

STEP 2: Process Repeating Events

In this step, we process the page for the horizontal structure of events. This processes events with event: repeat frontmatter duplicating pages and updating dates based on MTWRFSU params.

STEP 3: Process Reoccuring Events

The final processing step looks at pages with event: freq frontmatter. This clones the event vertically on a calender using daily, weekly, monthly, yearly params.

Returns

object —

Grav Pages List

preprocessEventPages()

preprocessEventPages(object  $collection) : object

STEP 1: Preprocess Event Pages

Preprocess the front matter for processing down the line this adds carbon _event: frontmatter data for processing repeating dates and etc.

Parameters

object $collection

Grav Collection

Returns

object —

$events Grav Collection

processRepeatingEvents()

processRepeatingEvents(object  $collection) : object

STEP 2: Process Repeating Events

Search for event: repeat: frontmatter and add repeating events to the collection via [MTWRFSU].

Parameters

object $collection

Grav Collection

Returns

object —

Grav Collection

processReoccuringEvents()

processReoccuringEvents(object  $collection) : object

STEP 3: Process Reoccuring Events

Search for event: freq: frontmatter and add pages vertically down the calendar to the collection. This processor will also look for event: until: frontmatter for determining when to stop processing the reoccuring event. If this front matter doesn't exist, then the plugin will look for a value set in the plugin config (+6 months) and process reoccuring event out to this date. If you need the event to reoccur further than this default then you must set an until date.

Parameters

object $collection

Grav Collection

Returns

object —

Grav Collection

clonePage()

clonePage(object  $page, array  $dates, string  $rule = null) : object

Clone an Event Page

This function clones a Grav Page and adds it as a virtual page to $this->pages. It also adds the page to $this->taxonomy so that we can query pages in templates and collection headers using @taxonomy.event. This will not create a physical page that is added to the filesystem.

Adding a new page to the system happens by adding the new dates to the event: frontmatter, updating the $page->date, and adding a new and unique $page->path and $page->route.

Parameters

object $page

Grav Page

array $dates

Carbon Dates

string $rule

Rule for repeating events

Returns

object —

Grav Page