Documentation

Pagenode extends Treenode
in package

Represents a page in a page tree

Table of Contents

Properties

$children  : array<string|int, static>
$parent  : static|null
$data  : mixed

Methods

__construct()  : mixed
Creates a node, with the specified data
__get()  : mixed
Generic field getter for unknown properties - used for TreeNode->children
__set()  : mixed
Generic field getter for unknown properties - used for TreeNode->children
filterChildren()  : mixed
Filter the children of this node, removing any children which don't match the specified TreenodeMatcher.
findAllNodes()  : array<string|int, static>
Finds all nodes which match the specified matcher.
findAncestors()  : array<string|int, static>
Finds all ancestors of a specific node, including the node, not including the root node of the tree The array is in order from top to bottom, so $ancestors[0] is the top-parent, and $ancestors[len-1] is the node.
findNode()  : static|null
Finds a node by looking at this node If that does not match, looking at each of this nodes children in turn.
findNodeValue()  : PageNode|null
Finds a node by looking at this node If that does not match, looking at each of this nodes children in turn.
getAllChildren()  : mixed
Returns an array of all children nodes, including sub-children
getBanner()  : string|null
Returns the filename to use for the banner image.
getChildren()  : array<string|int, static>
getFriendlyUrl()  : string
Returns the friendly url for a node
getFriendlyUrlNoprefix()  : string
Returns the friendly url for a node - but don't include a directory prefix
getNavigationName()  : string
Returns the name that should be used to represent this node when rendering navigation elements on the front-end
getUrlName()  : string
Returns the name of this page only, when constructing a URL
isOrphan()  : bool
Is this node an orphan? Orphans are at the top of the tree, and they don't have any children.
isRoot()  : mixed
Returns true if this node is the root node
loadTree()  : Treenode
Not valid
offsetExists()  : mixed
ArrayAccess function for checking if a specified key exists
offsetGet()  : mixed
ArrayAccess function for getting a value by its key
offsetSet()  : mixed
ArrayAccess function for setting a value by its key
offsetUnset()  : mixed
ArrayAccess function for unsetting a value
removeFilter()  : mixed
Removes the currently active filter

Properties

$children

public array<string|int, static> $children

$parent

public static|null $parent = null

Methods

__construct()

Creates a node, with the specified data

public __construct([array<string|int, mixed> $data = null ]) : mixed
Parameters
$data : array<string|int, mixed> = null

Initial data for the node

__get()

Generic field getter for unknown properties - used for TreeNode->children

public & __get(string $field) : mixed

Be aware that data gotten through this getter is BY REFERENCE For by-value data retrival, use the array-access functions.

Parameters
$field : string

The field to get.

__set()

Generic field getter for unknown properties - used for TreeNode->children

public __set(string $field, mixed $value) : mixed
Parameters
$field : string

The field to set.

$value : mixed

The value to set.

filterChildren()

Filter the children of this node, removing any children which don't match the specified TreenodeMatcher.

public filterChildren(TreenodeMatcher $matcher) : mixed

The nodes are not actually removed, matching nodes are just added to a filtered children list Which is returned instead of the original children list.

Parameters
$matcher : TreenodeMatcher

findAllNodes()

Finds all nodes which match the specified matcher.

public findAllNodes(TreenodeMatcher $matcher) : array<string|int, static>
Parameters
$matcher : TreenodeMatcher

The matcher to use for finding the nodes.

Return values
array<string|int, static> —

The found nodes, or an empty array if no nodes were found.

findAncestors()

Finds all ancestors of a specific node, including the node, not including the root node of the tree The array is in order from top to bottom, so $ancestors[0] is the top-parent, and $ancestors[len-1] is the node.

public findAncestors() : array<string|int, static>

A B C D E F G H I

NODE RESULT ARRAY H B D H D B D B B A (empty)

Return values
array<string|int, static> —

The ancestors, as described above.

findNode()

Finds a node by looking at this node If that does not match, looking at each of this nodes children in turn.

public findNode(TreenodeMatcher $matcher) : static|null

If that does not match, return null

Parameters
$matcher : TreenodeMatcher

The matcher to use for finding the node.

Return values
static|null —

if found, null if not found.

findNodeValue()

Finds a node by looking at this node If that does not match, looking at each of this nodes children in turn.

public findNodeValue(mixed $key, mixed $value) : PageNode|null
Parameters
$key : mixed

The key to search for in the data

$value : mixed

The value to search for in the data

Return values
PageNode|null

getAllChildren()

Returns an array of all children nodes, including sub-children

public getAllChildren([mixed $exclude_id = null ][, mixed $indent_str = ' ' ][, mixed $indent = 0 ]) : mixed

The array will be id => name. This function requires the table to have a column named 'name'. The name field will be indented according to the depth. If specified, the exclude_id argument will be used to exclude nodes (and their children) according to id.

Parameters
$exclude_id : mixed = null
$indent_str : mixed = ' '
$indent : mixed = 0

getBanner()

Returns the filename to use for the banner image.

public getBanner() : string|null

Returns NULL if no banner has been defined for this page and a generic banner should be used instead.

Return values
string|null

getChildren()

public & getChildren() : array<string|int, static>
Return values
array<string|int, static>

getFriendlyUrl()

Returns the friendly url for a node

public getFriendlyUrl() : string
Return values
string

getFriendlyUrlNoprefix()

Returns the friendly url for a node - but don't include a directory prefix

public getFriendlyUrlNoprefix() : string
Return values
string

getNavigationName()

Returns the name that should be used to represent this node when rendering navigation elements on the front-end

public getNavigationName() : string
Return values
string —

N.B. NOT HTML-safe

getUrlName()

Returns the name of this page only, when constructing a URL

public getUrlName() : string
Return values
string

isOrphan()

Is this node an orphan? Orphans are at the top of the tree, and they don't have any children.

public isOrphan() : bool
Return values
bool —

if it's an orphan, false otherwise

isRoot()

Returns true if this node is the root node

public isRoot() : mixed

loadTree()

Not valid

public static loadTree(mixed $table[, array<string|int, mixed> $where = ['1'] ][, mixed $order = 'record_order' ]) : Treenode
Parameters
$table : mixed

The name of the table to load

$where : array<string|int, mixed> = ['1']
$order : mixed = 'record_order'

The column to order by. Defaults to 'record_order'

Return values
Treenode —

The loaded tree

offsetExists()

ArrayAccess function for checking if a specified key exists

public offsetExists(mixed $offset) : mixed
Parameters
$offset : mixed

The offset to check.

Attributes
#[ReturnTypeWillChange]

offsetGet()

ArrayAccess function for getting a value by its key

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

The offset to get.

Attributes
#[ReturnTypeWillChange]

offsetSet()

ArrayAccess function for setting a value by its key

public offsetSet(mixed $offset, mixed $value) : mixed
Parameters
$offset : mixed

The offset to set.

$value : mixed

The value to set.

Attributes
#[ReturnTypeWillChange]

offsetUnset()

ArrayAccess function for unsetting a value

public offsetUnset(mixed $offset) : mixed
Parameters
$offset : mixed

The offset to remove.

Attributes
#[ReturnTypeWillChange]

removeFilter()

Removes the currently active filter

public removeFilter() : mixed
On this page

Search results