Class Blueprint
A simplified data structure representing the relashionship between pages.
Methods summary
public static
Icybee\Modules\Pages\Blueprint
|
|
protected
|
|
public
mixed
|
#
__get( string $property )
Support for the $ordered_records property.
Support for the $ordered_records property.
Parameters
- $property
string $property
Returns
mixed
Throws
|
protected
|
|
protected
array[int]ActiveRecord
|
#
get_ordered_records( )
Returns the records of the blueprint ordered according to their position and
relation.
Returns the records of the blueprint ordered according to their position and
relation.
Note: The blueprint is populated with records if needed.
Returns
array[int]ActiveRecord
|
public
boolean
|
#
has_children( integer $nid )
Checks if a branch has children.
Checks if a branch has children.
Parameters
- $nid
integer $nid Identifier of the parent record.
Returns
boolean
|
public
integer
|
#
children_count( integer $nid )
Returns the number of children of a branch.
Returns the number of children of a branch.
Parameters
- $nid
integer $nid The identifier of the parent record.
Returns
integer
|
public
Icybee\Modules\Pages\Blueprint
|
#
subset( integer $nid = null, integer $depth = null, callable $filter = null )
Create a subset of the blueprint.
Create a subset of the blueprint.
A filter can be specified to filter out the nodes of the subset. The function
returns true to discart a node. The callback function have the
following signature:
function(BlueprintNode $node)
The following example demonstrate how offline nodes cen be filtered out.
<?php
use Icybee\Modules\Pages\BlueprintNode;
$subset = $core->models['pages']
->blueprint($site_id = 1)
->subset(null, null, function(BlueprintNode $node) {
return !$node->is_online;
});
Parameters
- $nid
integer $nid Identifier of the starting branch.
- $depth
integer $depth Maximum depth of the subset.
- $filter
callable $filter The filter callback.
Returns
|
public
array[int]\Icybee\Modules\Pages\Page
|
#
populate( )
Populates the blueprint by loading the associated records.
Populates the blueprint by loading the associated records.
The method adds the record property to the blueprint nodes.
Returns
array[int]\Icybee\Modules\Pages\Page
|
Magic methods summary
Properties summary
public
array[int]int
|
$relation
|
#
The child/parent relation.
The child/parent relation.
An array where each key/value is the identifier of a node and the idenfier of
its parent, or zero if the node has no parent.
|
public
array[int]array
|
$children
|
#
The parent/children relation.
The parent/children relation.
An array where each key/value is the identifier of a parent and an array made
of the identifiers of its children. Each key/value pair of the children value is
made of the child identifier.
|
public
array[int]BlueprintNode
|
$index
|
#
Index of the blueprint nodes.
Index of the blueprint nodes.
Blueprint nodes are instances of the Icybee\Modules\Pages\BlueprintNode class. The key of
the index is the identifier of the node, while the value is the node
instance.
|
public
array[int]BlueprintNode
|
$tree
|
|
public
ICanBoogie\ActiveRecord\Model
|
$model
|
#
Model associated with the blueprint.
Model associated with the blueprint.
|