TableNode
extends CompoundNode
in package
FinalYes
The cells of the header rows and then of the data rows are the children of the table, so that the compiler processes their content, such as the directives that are created at compile time.
Table of Contents
Properties
- $classes : string[]
- $columnWidth : array
- $data : array
- $headers : array
- $options : array<string, scalar|scalar[]|null>
- $value : TValue
Methods
- __construct() : mixed
- addChildNode() : void
- addMetaData() : void
- Attaches data about this node that is not part of its content.
- getChildren() : TValue[]
- getClasses() : string[]
- getClassesString() : string
- getCols() : int
- getColumnWidth() : int[]
- getData() : TableRow[]
- getHeaders() : TableRow[]
- getMetaData() : array<string, DataNode>
- getOption() : mixed
- getOptions() : array<string, scalar|scalar[]|null>
- getRows() : int
- getValue() : TValue
- hasOption() : bool
- pushChildNode() : void
- removeNode() : static
- A table keeps its shape: a removed cell becomes an empty cell of the same size.
- replaceNode() : static
- setClasses() : void
- Normalizes class names following the rules of identifier-normalization
- setValue() : void
- withColumnWidth() : TableNode
- withKeepExistingOptions() : static
- Adds $options as default options without overriding any options already set.
- withOptions() : static
- columnsOf() : TableColumn[]
- replaceColumn() : TableRow[]
Properties
$classes
protected
string[]
$classes
= []
$columnWidth
protected
array
$columnWidth
= []
$data
protected
array
$data
$headers
protected
array
$headers
= []
$options
protected
array<string, scalar|scalar[]|null>
$options
= []
$value
protected
TValue
$value
Methods
__construct()
public
__construct(TableRow[] $data[, TableRow[] $headers = [] ][, int[] $columnWidth = [] ]) : mixed
Parameters
addChildNode()
public
addChildNode(TValue $node) : void
Parameters
- $node : TValue
addMetaData()
Attaches data about this node that is not part of its content.
public
addMetaData(DataNode $data) : void
Rendered as a data-* attribute where the node's template asks for
it. A name that is already taken gets the new values added to the ones
it has, rather than replaced by them. DataNode
Parameters
- $data : DataNode
getChildren()
public
getChildren() : TValue[]
Return values
TValue[]getClasses()
public
getClasses() : string[]
Return values
string[]getClassesString()
public
getClassesString() : string
Return values
stringgetCols()
public
getCols() : int
Return values
intgetColumnWidth()
public
getColumnWidth() : int[]
Return values
int[]getData()
public
getData() : TableRow[]
Return values
TableRow[]getHeaders()
public
getHeaders() : TableRow[]
Return values
TableRow[]getMetaData()
public
getMetaData() : array<string, DataNode>
Return values
array<string, DataNode> —keyed by name
getOption()
public
getOption(string $name[, TType|null $default = null ]) : mixed
Parameters
- $name : string
- $default : TType|null = null
Tags
getOptions()
public
getOptions() : array<string, scalar|scalar[]|null>
Return values
array<string, scalar|scalar[]|null>getRows()
public
getRows() : int
Return values
intgetValue()
public
getValue() : TValue
Return values
TValuehasOption()
public
hasOption(string $name) : bool
Parameters
- $name : string
Return values
boolpushChildNode()
public
pushChildNode(TValue $node) : void
Parameters
- $node : TValue
removeNode()
A table keeps its shape: a removed cell becomes an empty cell of the same size.
public
removeNode(int $key) : static
Parameters
- $key : int
Return values
staticreplaceNode()
public
replaceNode(int $key, TableColumn $node) : static
Parameters
- $key : int
- $node : TableColumn
Return values
staticsetClasses()
Normalizes class names following the rules of identifier-normalization
public
setClasses(string[] $classes) : void
Parameters
- $classes : string[]
Tags
setValue()
public
setValue(TValue $value) : void
Parameters
- $value : TValue
withColumnWidth()
public
withColumnWidth(int[] $columnWidth) : TableNode
Parameters
- $columnWidth : int[]
Return values
TableNodewithKeepExistingOptions()
Adds $options as default options without overriding any options already set.
public
withKeepExistingOptions(array<string, scalar|null> $options) : static
Parameters
- $options : array<string, scalar|null>
Return values
staticwithOptions()
public
withOptions(array<string, scalar|scalar[]|null> $options) : static
Parameters
- $options : array<string, scalar|scalar[]|null>
Return values
staticcolumnsOf()
private
columnsOf(TableRow[] $rows) : TableColumn[]
Parameters
- $rows : TableRow[]
Return values
TableColumn[]replaceColumn()
private
replaceColumn(TableRow[] $rows, int $key, TableColumn $node, int &$position) : TableRow[]
Parameters
- $rows : TableRow[]
- $key : int
- $node : TableColumn
- $position : int