PHP Class TableSummaryModule, vanilla

Since: 2.3
Author: Becky Van Bussel ([email protected])
Inheritance: extends Gdn_Module
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( $title = '' )
addColumn ( string $key, string $name = '', array $attributes = [], string $columnClass = '' ) : TableSummaryModule Add a column to the table.
addColumnIf ( boolean | string | array $isAllowed, string $key, string $name = '', array $attributes = [], string $columnClass = '' ) : TableSummaryModule Add a column to the table if it satisfies the $isAllowed condition.
addRow ( array $row = [], string $key = '', array $attributes = [] ) : TableSummaryModule Adds a row to the table. Constrains our data to the columns we've added.
getColumns ( ) : array
getRows ( ) : array
getTitle ( ) : string
prepare ( ) : boolean Prepares the media item for rendering. Adds column-type css classes to cells in the table.
setTitle ( string $title )

Method Details

__construct() public méthode

public __construct ( $title = '' )

addColumn() public méthode

Add a column to the table.
public addColumn ( string $key, string $name = '', array $attributes = [], string $columnClass = '' ) : TableSummaryModule
$key string The key name of the column.
$name string The display-name of the column.
$attributes array The attributes for the heading cell.
$columnClass string The css class to propagate to every cell in this column.
Résultat TableSummaryModule $this

addColumnIf() public méthode

Add a column to the table if it satisfies the $isAllowed condition.
public addColumnIf ( boolean | string | array $isAllowed, string $key, string $name = '', array $attributes = [], string $columnClass = '' ) : TableSummaryModule
$isAllowed boolean | string | array Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check.
$key string The key name of the column.
$name string The display-name of the column.
$attributes array The attributes for the th cell.
$columnClass string The css class to propagate to every cell in this column.
Résultat TableSummaryModule $this

addRow() public méthode

Adds a row to the table. Constrains our data to the columns we've added.
public addRow ( array $row = [], string $key = '', array $attributes = [] ) : TableSummaryModule
$row array An array representing a row where the key matches a column key and the value is either an HTML-formatted string or an object with a toString() method. (Something echo-able.)
$key string The key for the row. Nothing to do with the column key. Here for expansion, like in case we want to sort items eventually.
$attributes array The attributes on the tr element.
Résultat TableSummaryModule $this

getColumns() public méthode

public getColumns ( ) : array
Résultat array An array of column-type arrays. A column array has the following keys: key, name, attributes, columnClass.

getRows() public méthode

public getRows ( ) : array
Résultat array An array of row-type arrays. Each row array has a cells and attributes key. The cells key holds an array of 'column-key' => 'cell-content' data.

getTitle() public méthode

public getTitle ( ) : string
Résultat string The table title.

prepare() public méthode

Prepares the media item for rendering. Adds column-type css classes to cells in the table.
public prepare ( ) : boolean
Résultat boolean Whether to render the module.

setTitle() public méthode

public setTitle ( string $title )
$title string