Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Templates class also inherits all the methods and properties of: WireSaveableItems and Wire.
Common
| Name | Return | Summary | |
|---|
$templates->add() $templates->add(string $name) $templates->add(string $name, array $properties = []) | Template | Add and save new template (and fieldgroup) with given name and return it | |
$templates->clone() $templates->clone($item) $templates->clone($item, string $name = '') | bool Template | Clone the given Template | |
$templates->delete() $templates->delete($item) $templates->delete($item) | bool | Delete a Template | |
$templates->get() $templates->get($key) $templates->get($key) | Template null string | Get a template by name or ID | |
$templates->getNumPages() $templates->getNumPages(Template $tpl) $templates->getNumPages(Template $tpl) | int | Return the number of pages using the provided Template | |
$templates->getPageClass() $templates->getPageClass(Template $template) $templates->getPageClass(Template $template, bool $withNamespace = true) | string | Get class name to use for pages using given Template | |
$templates->getParentPage() $templates->getParentPage(Template $template) $templates->getParentPage(Template $template, bool $checkAccess = false, $getAll = false) | Page NullPage null PageArray | Return the parent page that this template assumes new pages are added to | |
$templates->getParentPages() $templates->getParentPages(Template $template) $templates->getParentPages(Template $template, bool $checkAccess = false, int $maxStatus = 0) | PageArray | Return all possible parent pages for the given template, if predefined | |
$templates->getTags() $templates->getTags() $templates->getTags(bool $getTemplateNames = false) | array | Get all tags used by templates | |
$templates->new() $templates->new($name) $templates->new($name, $settings = []) | Template | Create and save a new Template and Fieldgroup | |
$templates->newTemplate() $templates->newTemplate($name) $templates->newTemplate($name, $settings = []) | Template | Create new template in memory | |
$templates->rename() $templates->rename(Template $template, string $name) $templates->rename(Template $template, string $name) | None | Rename given template (and its fieldgroup, and file, when possible) | |
$templates->save() $templates->save($item) $templates->save($item) | bool | Save a Template | |
For hooks
These methods are only useful for hooking and should not be called directly.
Additional methods and properties
In addition to the methods and properties above, Templates also inherits the methods and properties of these classes:
API reference based on ProcessWire core version 3.0.259