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) {
|
||||||
return sprintf(
|
if ($link = $item->Link()) {
|
||||||
'<a href="%s" class="cms-panel-link external-link action" target="_blank">%s</a>',
|
return sprintf(
|
||||||
Convert::raw2att($item->Link()),
|
'<a href="%s" class="cms-panel-link external-link action" target="_blank">%s</a>',
|
||||||
$item->obj('ParentTitle')->forTemplate()
|
Convert::raw2att($link),
|
||||||
);
|
$item->obj('ParentTitle')->forTemplate()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return $item->obj('ParentTitle')->forTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user