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
= true
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
= false
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
= false
Specifies if this column can be searched.
public
$sortable
:
bool
= true
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
= "text"
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.
Property | Type | Description |
---|---|---|
$columnName | string |
string
|
$label | string |
string
|
public displayAs (string $type, $config)
Specifies a list column rendering mode. Supported modes are:
- text - text column, aligned left
- number - numeric column, aligned right
Property | Type | Description |
---|---|---|
$type | string |
string
Specifies a render mode as described above |
$config | mixed |
mixed
|
public getAlignClass () : string
Returns the column specific aligment css class.
public
getConfig (string $value, string $default = null
)
: mixed
Returns a raw config item value.
Property | Type | Description |
---|---|---|
$value | string |
string
|
$default | string |
string
|
public
getId (string $suffix = null
)
: string
Returns a value suitable for the column id property.
Property | Type | Description |
---|---|---|
$suffix | string |
string
Specify a suffix string |
public getName () : string
Returns a HTML valid name for the column name.
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.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$default | mixed |
mixed
|
protected evalConfig (array $config) : array
Process options and apply them to this object.
Property | Type | Description |
---|---|---|
$config | array |
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.
Property | Type | Description |
---|---|---|
$columnName | string |
string
|
$data | mixed |
mixed
|
$default | mixed |
mixed
|