ListColumn

List Columns definition A translation of the list column configuration

 class Backend\Classes\ListColumn

Properties

public $align : string

Specifies the alignment of this column.

public $clickable : bool

If set to false, disables the default click behavior when the column is clicked.

public $columnName : string

List column name.

public $config : array

Raw field configuration.

public $cssClass : string

Specify a CSS class to attach to the list cell element.

public $defaults : string

Specifies a default value when value is empty.

public $format : string

Specify a format or style for the column value, such as a Date.

public $headCssClass : string

Specify a CSS class to attach to the list header cell element.

public $invisible : bool

Specifies if this column is hidden by default.

public $label : string

List column label.

public $path : string

Specifies a path for partial-type fields.

public $relation : string

Relation name, if this column represents a model relationship.

public $searchable : bool

Specifies if this column can be searched.

public $sortable : bool

Specifies if this column can be sorted.

public $sqlSelect : string

Custom SQL for selecting this record display value, the @ symbol is replaced with the table name.

public $type : string

Display mode. Text, number

public $valueFrom : string

Model attribute to use for the display value, this will override any $sqlSelect definition.

public $width : string

sets the column width, can be specified in percents (10%) or pixels (50px). There could be a single column without width specified, it will be stretched to take the available space.

Methods

public __construct (string $columnName, string $label)

Constructor.

Parameters
Property Description
$columnName
string
$label
string
Returns
mixed

public displayAs (string $type, $config)

Specifies a list column rendering mode. Supported modes are:

  • text - text column, aligned left
  • number - numeric column, aligned right
Parameters
Property Description
$type
string

Specifies a render mode as described above

$config
mixed
Returns
mixed

public getAlignClass () : string

Returns the column specific aligment css class.

Returns
string

public getConfig (string $value, string $default = null) : mixed

Returns a raw config item value.

Parameters
Property Description
$value
string
$default
string
Returns
mixed

public getId (string $suffix = null) : string

Returns a value suitable for the column id property.

Parameters
Property Description
$suffix
string

Specify a suffix string

Returns
string

public getName () : string

Returns a HTML valid name for the column name.

Returns
string

public getValueFromData (mixed $data, mixed $default = null) : mixed

Returns this columns value from a supplied data set, which can be an array or a model or another generic collection.

Parameters
Property Description
$data
mixed
$default
mixed
Returns
mixed

protected evalConfig (array $config) : array

Process options and apply them to this object.

Parameters
Property Description
$config
array
Returns
array

protected getColumnNameFromData (string $columnName, mixed $data, mixed $default = null) : mixed

Internal method to extract the value of a column name from a data set.

Parameters
Property Description
$columnName
string
$data
mixed
$default
mixed
Returns
mixed
Copyright © 2024 Winter CMS