MarkedSet
class MarkedSet
Contains a set of hierarchical objects generated from a marking compilation run.
A set of nodes can be "marked" for later export, in order to prevent having to export the entire contents of a potentially huge tree.
Traits
Properties
array | $markingFilter | Optional filter callback for filtering nodes to mark |
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Create an empty set with the given class
Get total number of nodes to get. This acts as a soft lower-bounds for number of nodes to search until found.
Max number of nodes that can be physically rendered at any level.
Set hard limit of number of nodes to get for this level
Set max node count
Get method to use for getting children
Set method to use for getting children
Get method name for num children
Set method name to get num children
Returns the children of this DataObject as an XHTML UL. This will be called recursively on each child, so if they have children they will be displayed as a UL inside a LI.
Get child data formatted as JSON
Mark a segment of the tree, by calling mark().
Filter the marking to only those object with $node->$parameterName == $parameterValue
Filter the marking to only those where the function returns true. The node in question will be passed to the function.
Mark the children of the DataObject with the given ID.
Expose the given object in the tree, by marking this page and all it ancestors.
Return the IDs of all the marked nodes.
Reset marked nodes
Toggle limiting on or off
Check if limiting is enabled
Details
in Injectable at line 26
static Injectable
create(array $args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();
in Injectable at line 43
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
at line 99
__construct(DataObject $rootNode, string $childrenMethod = null, string $numChildrenMethod = null, int $nodeCountThreshold = null, int $maxChildNodes = null)
Create an empty set with the given class
at line 133
int
getNodeCountThreshold()
Get total number of nodes to get. This acts as a soft lower-bounds for number of nodes to search until found.
Defaults to value of node_threshold_total of hierarchy class.
at line 146
int
getMaxChildNodes()
Max number of nodes that can be physically rendered at any level.
Acts as a hard upper bound, after which nodes will be trimmed for performance reasons.
at line 158
$this
setMaxChildNodes(int $count)
Set hard limit of number of nodes to get for this level
at line 170
$this
setNodeCountThreshold(int $total)
Set max node count
at line 181
string
getChildrenMethod()
Get method to use for getting children
at line 205
$this
setChildrenMethod(string $method)
Set method to use for getting children
at line 224
string
getNumChildrenMethod()
Get method name for num children
at line 247
$this
setNumChildrenMethod(string $method)
Set method name to get num children
at line 270
string
renderChildren(string $template = null, array|callable $context = [])
Returns the children of this DataObject as an XHTML UL. This will be called recursively on each child, so if they have children they will be displayed as a UL inside a LI.
at line 294
array
getChildrenAsArray(callable $serialiseEval = null)
Get child data formatted as JSON
at line 451
$this
markPartialTree()
Mark a segment of the tree, by calling mark().
The method performs a breadth-first traversal until the number of nodes is more than minCount. This is used to get a limited number of tree nodes to show in the CMS initially.
This method returns the number of nodes marked. After this method is called other methods can check {@link isExpanded()} and {@link isMarked()} on individual nodes.
at line 484
$this
setMarkingFilter(string $parameterName, mixed $parameterValue)
Filter the marking to only those object with $node->$parameterName == $parameterValue
at line 500
$this
setMarkingFilterFunction(callable $callback)
Filter the marking to only those where the function returns true. The node in question will be passed to the function.
at line 618
bool
markById(int $id, bool $open = false)
Mark the children of the DataObject with the given ID.
at line 637
$this
markToExpose(DataObject $childObj)
Expose the given object in the tree, by marking this page and all it ancestors.
at line 655
array
markedNodeIDs()
Return the IDs of all the marked nodes.
at line 675
clearMarks()
Reset marked nodes
at line 688
$this
markExpanded(DataObject $node)
Mark this DataObject as expanded.
at line 702
$this
markUnexpanded(DataObject $node)
Mark this DataObject as unexpanded.
at line 716
$this
markOpened(DataObject $node)
Mark this DataObject's tree as opened.
at line 730
$this
markClosed(DataObject $node)
Mark this DataObject's tree as closed.
at line 744
bool
isMarked(DataObject $node)
Check if this DataObject is marked.
at line 757
bool
isExpanded(DataObject $node)
Check if this DataObject is expanded.
An expanded object has had it's children iterated through.
at line 770
bool
isTreeOpened(DataObject $node)
Check if this DataObject's tree is opened.
This is an expanded node which also should have children visually shown.
at line 808
$this
setLimitingEnabled(bool $enabled)
Toggle limiting on or off
at line 819
bool
getLimitingEnabled()
Check if limiting is enabled