Skip to content

Instantly share code, notes, and snippets.

@MartinMuzatko
Created September 13, 2017 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinMuzatko/013ee9082f3f04161fc5c027794dbf93 to your computer and use it in GitHub Desktop.
Save MartinMuzatko/013ee9082f3f04161fc5c027794dbf93 to your computer and use it in GitHub Desktop.
$events = new Events($this->wire);
$this->wire('events', $events, true);
<?php namespace ProcessWire;
class Events extends PagesType {
/**
* Construct the Events manager for the given parent and template
*
* @param Template|int|string|array $templates Template object or array of template objects, names or IDs
* @param int|Page|array $parents Parent ID or array of parent IDs (may also be Page or array of Page objects)
*/
public function __construct(ProcessWire $wire, $templates = array(), $parents = array()) {
parent::__construct($wire, $templates, $parents);
// Make sure we always include the event template and /events/ parent page
$this->addTemplates("event");
$this->addParents($this->pages->get("/events/")->id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment