Backend\Classes\ListColumn

Source: ~/modules/backend/classes/ListColumn.php

List Columns definition A translation of the list column configuration

Public properties

public string $columnName

List column name.

public string $label

List column label.

public string $type

Display mode. Text, number

public bool $searchable

Specifies if this column can be searched.

public bool $invisible

Specifies if this column is hidden by default.

public bool $sortable

Specifies if this column can be sorted.

public bool $clickable

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

public string $valueFrom

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

public string $defaults

Specifies a default value when value is empty.

public string $sqlSelect

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

public string $relation

Relation name, if this column represents a model relationship.

public string $width

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.

public string $cssClass

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

public string $headCssClass

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

public string $format

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

public string $path

Specifies a path for partial-type fields.

public string $align

Specifies the alignment of this column.

public array $config

Raw field configuration.

Public methods

public void __construct(string $columnName, string $label)

Constructor.

Parameters
  • string $columnName
  • string $label

public void displayAs(string $type, $config)

Specifies a list column rendering mode. Supported modes are:

  • text - text column, aligned left
  • number - numeric column, aligned right
Parameters
  • string $type - Specifies a render mode as described above
  • $config

public string getAlignClass()

Returns the column specific aligment css class.

public mixed getConfig(string $value, string $default=NULL)

Returns a raw config item value.

Parameters
  • string $value
  • string $default

public string getId(string $suffix=NULL)

Returns a value suitable for the column id property.

Parameters
  • string $suffix - Specify a suffix string

public string getName()

Returns a HTML valid name for the column name.

public mixed getValueFromData(mixed $data, mixed $default=NULL)

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

Parameters
  • mixed $data
  • mixed $default

Protected methods

protected array evalConfig(array $config)

Process options and apply them to this object.

Parameters
  • array $config

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

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

Parameters
  • string $columnName
  • mixed $data
  • mixed $default