Linkage Column
List Column
The linkage
column displays a hyperlink to the specified page.
website:
label: Website
type: linkage
The following properties are supported.
Property | Description |
---|---|
linkText | text to display for the link, optional. |
linkUrl | provide a URL instead of taking it from the record value |
attributes | an array of HTML attributes to pass to the anchor element. |
Use the attributes
property to add custom HTML attributes.
website:
label: Website
type: linkage
attributes:
target: _blank
The linkage
column type will automatically resolve page finder link values.
Use the linkUrl
and linkText
to explicitly provide a URL, which can either be a backend URI or a fully qualified URL. Attributes from the record will be resolved automatically.
open_link:
label: View
type: linkage
linkText: View Dashboard
linkUrl: backend/index/:code/:id
# Custom Link Text
By default, the value will be the URL to the linked location. For example, you may change the link text by returning an array value from the model.
['https://octobercms.com', 'October CMS']
In your model, you may wish to use an attribute modifier to supply these values. The following creates a new website_link
attribute on the model.
public function getWebsiteLinkAttribute()
{
return [$this->url, $this->name];
}
You may use the displayFrom
property to keep sorting and searching intact on the database value. The following will search and sort using the website
attribute and display the link using the website_link
attribute.
website:
label: Website
type: linkage
displayFrom: website_link