PagesType class

Provides an interface to the Pages class but specific to a given page class/type, with predefined parent and template.

This class is primarily used by the core as an alternative to $pages, providing an API for other Page types like User, Role, Permission, and Language. The $users, $roles, $permissions and $languages API variables are all instances of PagesType. This class is typically not instantiated on its own and instead acts as a base class which is extended.


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the PagesType class also inherits all the methods and properties of: Wire.

Show class?             Show args?        

Family

NameReturnSummary 
PagesType::addParents($parents)
(nothing)Add one or more of parents that this PagesType represents 
PagesType::addTemplates($templates)
(nothing)Add one or more templates that this PagesType represents 
PagesType::getPageClass()
stringGet the PHP class name used by Page objects of this type 
PagesType::getParent()
Page NullPageGet the parent Page object (or first parent Page object if there are multiple) 
PagesType::getParentID()
intGet the parent page ID used by this type (or first parent ID if there are multiple) 
PagesType::getParentIDs()
arrayGet the parent page IDs used by this type 
PagesType::getParents()
PageArrayGet the parent Page objects in a PageArray 
PagesType::getTemplate()
TemplateGet the template used by this type (or first template if there are multiple) 
PagesType::getTemplates()
array TemplateGet the templates (plural) used by this type 
PagesType::setPageClass(string $class)
(nothing)Set the PHP class name to use for Page objects of this type 

For hooks

These methods are only useful for hooking and should not be called directly.

NameReturnSummary 
PagesType::added(Page $page)
(nothing)Hook called when a new page of this type has been added
PagesType::deleteReady(Page $page)
(nothing)Hook called when a page is about to be deleted, but before data has been touched
PagesType::deleted(Page $page)
(nothing)Hook called when a page and its data have been deleted
PagesType::saveReady(Page $page)
arrayHook called just before a page of this type is saved
PagesType::saved(Page $page)
(nothing)Hook called after a page of this type is successfully saved

Additional methods and properties

In addition to the methods and properties above, PagesType also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.137

Twitter updates

  • ProcessWire 3.0.142 has a lot of updates but the biggest is the addition of custom fields support for file and image fields. In this post, we take a closer look at that, and also outline all of the new features in the just-released FormBuilder v40— More
    11 October 2019
  • This week’s dev branch version brings you improvements to ProcessWire’s input->cookie API variable, plus it adds the ability to modify system URLs and paths at runtime. This post also includes some examples to demonstrate just how useful this can be— More
    20 September 2019
  • New post: This week we’ll take a look at a new version of FormBuilder that's on the way (with a screencast), as well as the latest version of the core: ProcessWire 3.0.140— More
    6 September 2019

Latest news

  • ProcessWire Weekly #284
    In the 284th issue of ProcessWire Weekly we're going to take a quick look at the latest core updates, introduce a new module called InputfieldFloatRange, and continue our ongoing poll series #processwireworks. Read on!
    Weekly.pw / 20 October 2019
  • ProcessWire 3.0.142 core updates
    This latest version of the core on the dev branch has a lot of updates, and the biggest is the addition of custom fields support for file and image fields. In this post, we take a closer look and also outline all of the new features in the just-released FormBuilder v40.
    Blog / 11 October 2019
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull