Methods summary
public
|
|
public
PageArray
|
#
___find( string $selectorString, array $options = array() )
Given a Selector string, return the Page objects that match in a
PageArray.
Given a Selector string, return the Page objects that match in a
PageArray.
Parameters
- $selectorString
string
- $options
array - findOne: apply optimizations for finding a single page and include pages with
'hidden' status
Returns
|
public
Page|null
|
#
findOne( string $selectorString, $options = array() )
Like find() but returns only the first match as a Page object (not
PageArray)
Like find() but returns only the first match as a Page object (not
PageArray)
Parameters
- $selectorString
string
- $options
Returns
|
public
Page|NullPage
|
#
get( string $selectorString )
Returns only the first match as a Page object (not PageArray).
Returns only the first match as a Page object (not PageArray).
This is an alias of the findOne() method for syntactic convenience and
consistency. Using get() is preferred.
Parameters
Returns
Page|NullPageAlways returns a Page object, but will return NullPage (with id=0) when no match
found
|
public
PageArray
|
#
getById( array|WireArray|string $ids, Template $template = null, integer $parent_id = null )
Given an array or CSV string of Page IDs, return a PageArray
Given an array or CSV string of Page IDs, return a PageArray
Parameters
- $ids
array|WireArray|string Array of IDs or CSV string of IDs
- $template
Template Specify a template to make the load faster, because it won't have to attempt to
join all possible fields... just those used by the template.
- $parent_id
integer Specify a parent to make the load faster, as it reduces the possibility for
full table scans
Returns
|
public
integer
|
#
count( string $selectorString, $options = array() )
Count and return how many pages will match the given selector string
Count and return how many pages will match the given selector string
Parameters
- $selectorString
string
- $options
Returns
integer
|
public
boolean
|
#
isSaveable( Page $page, string & $reason )
Is the given page in a state where it can be saved?
Is the given page in a state where it can be saved?
Parameters
- $page
Page
- $reason
string Text containing the reason why it can't be saved (assuming it's not saveable)
Returns
boolean True if saveable, False if not
|
protected
|
#
___setupNew( Page $page )
Validate that a new page is in a saveable condition and correct it if
not.
Validate that a new page is in a saveable condition and correct it if
not.
Currently just sets up up a unique page->name based on the title if one
isn't provided already.
|
public
boolean
|
#
___save( Page $page, $options = array() )
Save a page object and it's fields to database.
Save a page object and it's fields to database.
If the page is new, it will be inserted. If existing, it will be updated.
This is the same as calling $page->save()
If you want to just save a particular field in a Page, use
$page->save($fieldName) instead.
Parameters
Returns
boolean True on success
|
public
boolean
|
#
___saveField( Page $page, string|Field $field )
Save just a field from the given page as used by Page::save($field)
Save just a field from the given page as used by Page::save($field)
This function is public, but the preferred manner to call it is with
$page->save($field)
Parameters
Returns
boolean True on success
|
protected
|
#
saveParents( integer $pages_id, integer $numChildren )
Save references to the Page's parents in pages_parents table, as well as any
other pages affected by a parent change
Save references to the Page's parents in pages_parents table, as well as any
other pages affected by a parent change
Any pages_id passed into here are assumed to have children
Parameters
- $pages_id
integer ID of page to save parents from
- $numChildren
integer Number of children this Page has
|
protected
|
#
savePageStatus( integer $pageID, integer $status, boolean $recursive = false, boolean $remove = false )
Sets a new Page status and saves the page, optionally recursive with the
children, grandchildren, and so on.
Sets a new Page status and saves the page, optionally recursive with the
children, grandchildren, and so on.
While this can be performed with other methods, this is here just to make it
fast for internal/non-api use. See the trash and restore methods for an
example.
Parameters
- $pageID
integer
- $status
integer Status per flags in Page::status* constants
- $recursive
boolean Should the status descend into the page's children, and grandchildren, etc?
- $remove
boolean Should the status be removed rather than added?
|
public
boolean
|
#
isDeleteable( Page $page )
Is the given page deleteable?
Is the given page deleteable?
Note: this does not account for user permission checking. It only checks if
the page is in a state to be saveable via the API.
Parameters
Returns
boolean True if deleteable, False if not
|
public
boolean
|
#
___trash( Page $page, boolean $save = true )
Move a page to the trash
If you have already set the parent to somewhere in the trash, then this
method won't attempt to set it again.
Parameters
- $page
Page
- $save
boolean Set to false if you will perform the save() call, as is the case when called
from the Pages::save() method.
Returns
boolean
|
protected
boolean
|
#
___restore( Page $page, boolean $save = true )
Restore a page from the trash back to a non-trash state
Restore a page from the trash back to a non-trash state
Note that this method assumes already have set a new parent, but have not yet
saved
Parameters
- $page
Page
- $save
boolean Set to false if you only want to prep the page for restore (i.e. being saved
elsewhere)
Returns
boolean
|
public
boolean
|
#
___delete( Page $page, boolean $recursive = false )
Permanently delete a page and it's fields.
Permanently delete a page and it's fields.
Unlike trash(), pages deleted here are not restorable.
If you attempt to delete a page with children, and don't specifically set the
$recursive param to True, then this method will throw an exception. If a
recursive delete fails for any reason, an exception will be thrown.
Parameters
- $page
Page
- $recursive
boolean If set to true, then this will attempt to delete all children too.
Returns
boolean
|
public
Page
|
#
___clone( Page $page, Page $parent = null, boolean $recursive = true )
Clone an entire page, it's assets and children and return it.
Clone an entire page, it's assets and children and return it.
Parameters
- $page
Page Page that you want to clone
- $parent
Page New parent, if different (default=same parent)
- $recursive
boolean Clone the children too? (default=true)
Returns
Pagethe newly cloned page or a NullPage() with id=0 if unsuccessful.
|
public
Page|array|null
|
#
getCache( integer|string|null $id = null )
Given a Page ID, return it if it's cached, or NULL of it's not.
Given a Page ID, return it if it's cached, or NULL of it's not.
If no ID is provided, then this will return an array copy of the full
cache.
You may also pass in the string "id=123", where 123 is the page_id
Parameters
Returns
|
public
|
#
cache( Page $page )
Cache the given page.
Parameters
|
public
|
#
uncache( Page $page )
Remove the given page from the cache.
Remove the given page from the cache.
Note: does not remove pages from selectorCache. Call uncacheAll to do
that.
Parameters
|
public
|
#
uncacheAll( )
Remove all pages from the cache.
Remove all pages from the cache.
|
protected
|
#
selectorCache( string $selector, array $options, PageArray $pages )
Cache the given selector string and options with the given PageArray
Cache the given selector string and options with the given PageArray
Parameters
- $selector
string
- $options
array
- $pages
PageArray return bool True of pages were cached, false if not
|
protected
array|null|string
|
#
getSelectorCache( string $selector, array $options, boolean $returnSelector = false )
Retrieve any cached page IDs for the given selector and options OR false if
none found.
Retrieve any cached page IDs for the given selector and options OR false if
none found.
You may specify a third param as TRUE, which will cause this to just return
the selector string (with hashed options)
Parameters
- $selector
string
- $options
array
- $returnSelector
boolean default false
Returns
array|null|string
|
public
PagesSortFields
|
#
sortfields( )
For internal Page instance access, return the Pages sortfields property
For internal Page instance access, return the Pages sortfields property
Returns
PagesSortFields
|
public
mixed|null
|
#
__get( string $key )
Return a fuel or other property set to the Pages instance
Return a fuel or other property set to the Pages instance
Parameters
Returns
mixed|null
|
public
|
#
setOutputFormatting( $outputFormatting = true )
Set whether loaded pages have their outputFormatting turn on or off
Set whether loaded pages have their outputFormatting turn on or off
By default, it is turned on.
|
protected
|
#
debugLog( string $action = '', string $details = '', string|object $result = '' )
Log a Pages class event
Only active in debug mode.
Parameters
- $action
string Name of action/function that occurred.
- $details
string Additional details, like a selector string.
- $result
string|object The value that was returned.
|
public
array
|
#
getDebugLog( string $action = '' )
Get the Pages class debug log
Get the Pages class debug log
Only active in debug mode
Parameters
- $action
string Optional action within the debug log to find
Returns
array
|
protected
|
#
___added( Page $page )
Hook called when a new page has been added
Hook called when a new page has been added
|
protected
|
#
___moved( Page $page )
Hook called when a page has been moved from one parent to another
Hook called when a page has been moved from one parent to another
Note the previous parent is in $page->parentPrevious
|
protected
|
#
___templateChanged( Page $page )
Hook called when a page's template has been changed
Hook called when a page's template has been changed
Note the previous template is in $page->templatePrevious
|
protected
|
#
___trashed( Page $page )
Hook called when a page has been moved to the trash
Hook called when a page has been moved to the trash
|
protected
|
#
___restored( Page $page )
Hook called when a page has been moved OUT of the trash
Hook called when a page has been moved OUT of the trash
|
protected
|
#
___deleteReady( Page $page )
Hook called when a page is about to be deleted, but before data has been
touched
Hook called when a page is about to be deleted, but before data has been
touched
This is different from a before(delete) hook because this hook is called once
it has been confirmed that the page is deleteable and WILL be deleted.
|
protected
|
#
___deleted( Page $page )
Hook called when a page and it's data have been deleted
Hook called when a page and it's data have been deleted
|
protected
|
#
___cloned( Page $page, Page $copy )
Hook called when a page has been cloned
Hook called when a page has been cloned
Parameters
- $page
Page The original page to be cloned
- $copy
Page The completed cloned version of the page
|