Adding possibility to define a custom text for the link

This commit is contained in:
Peter Thaleikis 2015-09-14 17:17:23 +12:00
parent 9a253f27f2
commit 4c8009ad02
2 changed files with 3 additions and 2 deletions

View File

@ -59,7 +59,8 @@ class GridFieldExternalLink extends GridFieldDataColumns {
*/
public function getColumnContent($gridField, $record, $columnName) {
$data = new ArrayData(array(
'Link' => $record->hasMethod('getExternalLink') ? $record->getExternalLink() : $record->ExternalLink
'Link' => $record->hasMethod('getExternalLink') ? $record->getExternalLink() : $record->ExternalLink,
'Text' => $record->hasMethod('getExternalLinkText') ? $record->getExternalLinkText() : 'External Link'
));
return $data->renderWith('GridFieldExternalLink');

View File

@ -1 +1 @@
<a href="$Link" target="_blank" title="<% _t('GridFieldExtensions.ExternalLink','External Link') %>"><% _t('GridFieldExtensions.ExternalLink','External Link') %></a>
<a href="$Link" target="_blank" title="$Text">$Text</a>