Class to handle preparing nodes of a specified type for display.

package XenForo_Nodes

 Methods

Gets the extra, node-type-specified data for the list of nodes.

getExtraDataForNodes(array $nodeIds) : array

Parameters

$nodeIds

array

Returns

arrayFormat: [node id] => info

Gets a count of total items in this node, broken down to discussions and messages.

getNodeItemCounts(array $node) : array

Parameters

$node

array

Returns

arrayKeys: discussions, messages

Gets the effective data that can be pushed up to a parent node.

getPushableDataForNode(array $node, array $childPushable, array $permissions) : array

Parameters

$node

array

Current node info

$childPushable

array

List of pushable data from all child nodes: [node id] => pushable data

$permissions

array

Permissions for this node

Returns

arrayList of pushable data (key-value pairs)

Determines if the specified node is viewable with the given permissions.

isNodeViewable(array $node, array $nodePermissions) : boolean

Parameters

$node

array

Node info

$nodePermissions

array

Permissions for this node

Returns

boolean

Do type-specific node preparations.

prepareNode(array $node) : array

Parameters

$node

array

Unprepared data

Returns

arrayPrepared data

Renders the specified node for display in a node tree.

renderNodeForTree(\XenForo_View $view, array $node, array $permissions, array $renderedChildren, integer $level) : string | \XenForo_Template_Abstract

Note that if using a template, it is preferable to not explicitly render the template here, but to return the object instead.

Parameters

$view

\XenForo_View

View object doing the rendering

$node

array

Information about this node

$permissions

array

Pemissions for this node

$renderedChildren

array

List of rendered children, [node id] => rendered output

$level

integer

The level this node should be rendered at, relative to how it's to be displayed.

Returns

Takes collected pushable data and compiles it with the child pushable data into a final value.

_compileForumLikePushableData(array $newPushable, array $childPushable) : array

Parameters

$newPushable

array

$childPushable

array

Returns

array

Gets the pushable data for a forum-like node.

_getForumLikePushableData(array $node, array $childPushable) : array

Most nodes, including categories and forums, will fall into this category, provided the key names match.

This function does not check any permissions.

Parameters

$node

array

Info about the current node

$childPushable

array

List of pushable data for child nodes ([node id] => info)

Returns

arrayKey-value pairs of pushable data