mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
fix: field formatting to correct include link
This commit is contained in:
parent
6782048463
commit
d87dbc8367
@ -27,12 +27,16 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor
|
|||||||
/** @var GridFieldDataColumns $columns */
|
/** @var GridFieldDataColumns $columns */
|
||||||
$columns = $this->getComponentByType(GridFieldDataColumns::class);
|
$columns = $this->getComponentByType(GridFieldDataColumns::class);
|
||||||
$columns->setFieldFormatting([
|
$columns->setFieldFormatting([
|
||||||
'ParentTitle' => function ($value, &$item) {
|
'Parent.Title' => function ($value, &$item) {
|
||||||
|
if ($link = $item->Link()) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<a href="%s" class="cms-panel-link external-link action" target="_blank">%s</a>',
|
'<a href="%s" class="cms-panel-link external-link action" target="_blank">%s</a>',
|
||||||
Convert::raw2att($item->Link()),
|
Convert::raw2att($link),
|
||||||
$item->obj('ParentTitle')->forTemplate()
|
$item->obj('ParentTitle')->forTemplate()
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return $item->obj('ParentTitle')->forTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user