class Node (View source)

The Node is the building block for the collapsible navigation tree

Constants

CONTAINER

OBJECT

Properties

string $name
string $realName
int $type
bool $isGroup
bool $visible
Node $parent
Node[] $children
mixed $separator
int $separatorDepth
array<string,string> $icon

For the IMG tag, used when rendering the node.

$links

An array of A tags, used when rendering the node.

string $title
string $classes
bool $isNew
int $pos2
int $pos3
protected Relation $relation
string $displayName
string|null $urlParamName

Methods

__construct(string $name, int $type = self::OBJECT, bool $isGroup = false)

Initialises the class by setting the mandatory variables

void
addChild(Node $child)

Adds a child node to this node

Node|null
getChild(string $name, bool $realName = false)

Returns a child node given it's name

void
removeChild(string $name)

Removes a child node from this node

array
parents(bool $self = false, bool $containers = false, bool $groups = false)

Retrieves the parents for a node

Node|false
realParent()

Returns the actual parent of a node. If used twice on an index or columns node, it will return the table and database nodes. The names of the returned nodes can be used in SQL queries, etc.

bool
hasChildren(bool $countEmptyContainers = true)

This function checks if the node has children nodes associated with it

bool
hasSiblings()

Returns true if the node has some siblings (other nodes on the same tree level, in the same branch), false otherwise.

int
numChildren()

Returns the number of child nodes that a node has associated with it

array
getPaths()

Returns the actual path and the virtual paths for a node both as clean arrays and base64 encoded strings

array
getData(string $type, int $pos, string $searchClause = '')

Returns the names of children of type $type present inside this container This method is overridden by the PhpMyAdmin\Navigation\Nodes\NodeDatabase and PhpMyAdmin\Navigation\Nodes\NodeTable classes

int
getPresence(string $type = '', string $searchClause = '')

Returns the number of children of type $type present inside this container This method is overridden by the PhpMyAdmin\Navigation\Nodes\NodeDatabase and PhpMyAdmin\Navigation\Nodes\NodeTable classes

string
getHtmlForControlButtons()

Returns HTML for control buttons displayed infront of a node

string
getCssClasses(bool $match)

Returns CSS classes for a node

string
getIcon(bool $match)

Returns icon for the node

array|null
getNavigationHidingData()

Gets the count of hidden elements for each database

Details

__construct(string $name, int $type = self::OBJECT, bool $isGroup = false)

Initialises the class by setting the mandatory variables

Parameters

string $name

An identifier for the new node

int $type

Type of node, may be one of CONTAINER or OBJECT

bool $isGroup

Whether this object has been created while grouping nodes

void addChild(Node $child)

Adds a child node to this node

Parameters

Node $child

A child node

Return Value

void

Node|null getChild(string $name, bool $realName = false)

Returns a child node given it's name

Parameters

string $name

The name of requested child

bool $realName

Whether to use the "realName" instead of "name" in comparisons

Return Value

Node|null

The requested child node or null, if the requested node cannot be found

void removeChild(string $name)

Removes a child node from this node

Parameters

string $name

The name of child to be removed

Return Value

void

array parents(bool $self = false, bool $containers = false, bool $groups = false)

Retrieves the parents for a node

Parameters

bool $self

Whether to include the Node itself in the results

bool $containers

Whether to include nodes of type CONTAINER

bool $groups

Whether to include nodes which have $group == true

Return Value

array

An array of parent Nodes

Node|false realParent()

Returns the actual parent of a node. If used twice on an index or columns node, it will return the table and database nodes. The names of the returned nodes can be used in SQL queries, etc.

..

Return Value

Node|false

bool hasChildren(bool $countEmptyContainers = true)

This function checks if the node has children nodes associated with it

Parameters

bool $countEmptyContainers

Whether to count empty child containers as valid children

Return Value

bool

bool hasSiblings()

Returns true if the node has some siblings (other nodes on the same tree level, in the same branch), false otherwise.

The only exception is for nodes on the third level of the tree (columns and indexes), for which the function always returns true. This is because we want to render the containers for these nodes

Return Value

bool

int numChildren()

Returns the number of child nodes that a node has associated with it

Return Value

int

The number of children nodes

array getPaths()

Returns the actual path and the virtual paths for a node both as clean arrays and base64 encoded strings

Return Value

array

array getData(string $type, int $pos, string $searchClause = '')

Returns the names of children of type $type present inside this container This method is overridden by the PhpMyAdmin\Navigation\Nodes\NodeDatabase and PhpMyAdmin\Navigation\Nodes\NodeTable classes

Parameters

string $type

The type of item we are looking for ('tables', 'views', etc)

int $pos

The offset of the list within the results

string $searchClause

A string used to filter the results of the query

Return Value

array

int getPresence(string $type = '', string $searchClause = '')

Returns the number of children of type $type present inside this container This method is overridden by the PhpMyAdmin\Navigation\Nodes\NodeDatabase and PhpMyAdmin\Navigation\Nodes\NodeTable classes

Parameters

string $type

The type of item we are looking for ('tables', 'views', etc)

string $searchClause

A string used to filter the results of the query

Return Value

int

string getHtmlForControlButtons()

Returns HTML for control buttons displayed infront of a node

Return Value

string

HTML for control buttons

string getCssClasses(bool $match)

Returns CSS classes for a node

Parameters

bool $match

Whether the node matched loaded tree

Return Value

string

with html classes.

string getIcon(bool $match)

Returns icon for the node

Parameters

bool $match

Whether the node matched loaded tree

Return Value

string

with image name

array|null getNavigationHidingData()

Gets the count of hidden elements for each database

Return Value

array|null

array containing the count of hidden elements for each database