GridFieldExternalLink
class GridFieldExternalLink extends GridFieldDataColumns (View source)
Displays a link to an external source referenced 'external link'
Traits
A class that can be instantiated or replaced via DI
Properties
public | array | $fieldCasting | from GridFieldDataColumns | |
public | array | $fieldFormatting | from GridFieldDataColumns | |
protected | array | $displayFields | This is the columns that will be visible |
from GridFieldDataColumns |
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Set whether status flags are displayed in this gridfield
Get whether status flags are displayed in this gridfield
Set which columns can be used to display the status flags.
Get which columns can be used to display the status flags.
Override the default behaviour of showing the models summaryFields with these fields instead Example: array( 'Name' => 'Members name', 'Email' => 'Email address')
Specify castings with fieldname as the key, and the desired casting as value.
Specify custom formatting for fields, e.g. to render a link instead of pure text.
Determines whether this component escapes strings returned from getColumnContent().
Get whether this component escapes strings returned from getColumnContent().
Return any special attributes that will be used for FormField::create_tag()
Casts a field to a string which is safe to insert into HTML
Remove values from a value using FieldEscape setter
Details
static Injectable
create(mixed ...$args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create(SiteTree::class); $list = SiteTree::get();
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
augmentColumns(GridField $gridField, array $columns)
Add a column for the actions
array
getColumnsHandled(GridField $gridField)
Which columns are handled by this component
GridFieldDataColumns
setDisplayStatusFlags(bool $display)
Set whether status flags are displayed in this gridfield
bool
getDisplayStatusFlags()
Get whether status flags are displayed in this gridfield
GridFieldDataColumns
setColumnsForStatusFlag(array $columns)
Set which columns can be used to display the status flags.
The first column from this list found in the gridfield will be used.
array
getColumnsForStatusFlag()
Get which columns can be used to display the status flags.
The first column from this list found in the gridfield will be used.
$this
setDisplayFields(array $fields)
Override the default behaviour of showing the models summaryFields with these fields instead Example: array( 'Name' => 'Members name', 'Email' => 'Email address')
array
getDisplayFields(GridField $gridField)
Get the DisplayFields
$this
setFieldCasting(array $casting)
Specify castings with fieldname as the key, and the desired casting as value.
Example: array("MyCustomDate"=>"Date","MyShortText"=>"Text->FirstSentence")
array
getFieldCasting()
No description
$this
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.
array
getFieldFormatting()
No description
GridFieldDataColumns
setDoEscapeFields(bool $doEscapeFields)
Determines whether this component escapes strings returned from getColumnContent().
This is useful because by default strings are escaped for use in HTML. This means there are some circumstances in which the escaping done here can result in double escaping those values further down the line, such as use with GridFieldPrintButton which temporarily sets this to false.
bool
getDoEscapeFields()
Get whether this component escapes strings returned from getColumnContent().
string
getColumnContent(GridField $gridField, ModelData $record, string $columnName)
No description
array
getColumnAttributes(GridField $gridField, ModelData $record, string $columnName)
Return any special attributes that will be used for FormField::create_tag()
array
getColumnMetadata(GridField $gridField, string $columnName)
Add the title
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, ModelData $item, string $fieldName, string $value)
No description
protected string
escapeValue(GridField $gridField, string $value)
Remove values from a value using FieldEscape setter