class GridFieldDataColumns implements GridField_ColumnProvider (View source)

Properties

public array $fieldCasting
public array $fieldFormatting
protected array $displayFields

This is the columns that will be visible

Methods

public
augmentColumns(GridField $gridField, array $columns)

Modify the list of columns displayed in the table.

public
array
getColumnsHandled(GridField $gridField)

Names of all columns which are affected by this component.

public
setDisplayFields(array $fields)

Override the default behaviour of showing the models summaryFields with these fields instead Example: array( 'Name' => 'Members name', 'Email' => 'Email address')

public
array
getDisplayFields($gridField)

Get the DisplayFields

public
setFieldCasting(array $casting)

Specify castings with fieldname as the key, and the desired casting as value.

public
array
getFieldCasting()

No description

public
setFieldFormatting(array $formatting)

Specify custom formatting for fields, e.g. to render a link instead of pure text.

public
array
getFieldFormatting()

No description

public
string
getColumnContent(GridField $gridField, DataObject $record, string $columnName)

HTML for the column, content of the element.

public
array
getColumnAttributes(GridField $gridField, DataObject $record, string $columnName)

Attributes for the element containing the content returned by getColumnContent().

public
array
getColumnMetadata(GridField $gridField, string $column)

Additional metadata about the column which can be used by other components, e.g. to set a title for a search column header.

protected
string|null
getValueFromRelation(DataObject $record, string $columnName)

Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns

protected
string
castValue(GridField $gridField, string $fieldName, string $value)

Casts a field to a string which is safe to insert into HTML

protected
string
formatValue(GridField $gridField, DataObject $item, string $fieldName, string $value)

No description

protected
string
escapeValue(GridField $gridField, string $value)

Remove values from a value using FieldEscape setter

Details

augmentColumns(GridField $gridField, array $columns)

Modify the list of columns displayed in the table.

See GridFieldDataColumns->getDisplayFields()} and {@link GridFieldDataColumns.

Parameters

GridField $gridField
array $columns

List of columns

array getColumnsHandled(GridField $gridField)

Names of all columns which are affected by this component.

Parameters

GridField $gridField

Return Value

array

setDisplayFields(array $fields)

Override the default behaviour of showing the models summaryFields with these fields instead Example: array( 'Name' => 'Members name', 'Email' => 'Email address')

Parameters

array $fields

array getDisplayFields($gridField)

Get the DisplayFields

Parameters

$gridField

Return Value

array

See also

GridFieldDataColumns::setDisplayFields

setFieldCasting(array $casting)

Specify castings with fieldname as the key, and the desired casting as value.

Example: array("MyCustomDate"=>"Date","MyShortText"=>"Text->FirstSentence")

Parameters

array $casting

array getFieldCasting()

No description

Return Value

array

setFieldFormatting(array $formatting)

Specify custom formatting for fields, e.g. to render a link instead of pure text.

Caution: Make sure to escape special php-characters like in a normal php-statement. Example: "myFieldName" => '<a href=\"custom-admin/$ID\">$ID'.

Alternatively, pass a anonymous function, which takes two parameters: The value and the original list item.

Formatting is applied after field casting, so if you're modifying the string to include further data through custom formatting, ensure it's correctly escaped.

Parameters

array $formatting

array getFieldFormatting()

No description

Return Value

array

string getColumnContent(GridField $gridField, DataObject $record, string $columnName)

HTML for the column, content of the element.

Parameters

GridField $gridField
DataObject $record
  • Record displayed in this row
string $columnName

Return Value

string
  • HTML for the column. Return NULL to skip.

array getColumnAttributes(GridField $gridField, DataObject $record, string $columnName)

Attributes for the element containing the content returned by getColumnContent().

Parameters

GridField $gridField
DataObject $record

displayed in this row

string $columnName

Return Value

array

array getColumnMetadata(GridField $gridField, string $column)

Additional metadata about the column which can be used by other components, e.g. to set a title for a search column header.

Parameters

GridField $gridField
string $column

Return Value

array
  • Map of arbitrary metadata identifiers to their values.

protected string|null getValueFromRelation(DataObject $record, string $columnName)

Translate a Object.RelationName.ColumnName $columnName into the value that ColumnName returns

Parameters

DataObject $record
string $columnName

Return Value

string|null
  • returns null if it could not found a value

protected string castValue(GridField $gridField, string $fieldName, string $value)

Casts a field to a string which is safe to insert into HTML

Parameters

GridField $gridField
string $fieldName
string $value

Return Value

string

protected string formatValue(GridField $gridField, DataObject $item, string $fieldName, string $value)

No description

Parameters

GridField $gridField
DataObject $item
string $fieldName
string $value

Return Value

string

protected string escapeValue(GridField $gridField, string $value)

Remove values from a value using FieldEscape setter

Parameters

GridField $gridField
string $value

Return Value

string