Hyperlink within Gridfield

$gridField = new GridField(“ContentBlockParameters”, “Used on the following content block parameters”,
$this->owner->ContentBlockParameters(), $relationConfig);

$config = $gridField->getConfig();
$dataColumns = $config->getComponentByType(‘GridFieldDataColumns’);

$dataColumns->setFieldFormatting(array(
‘PageLink’ => function($value, $contentBlockParameter) {
$page = $contentBlockParameter->getPage();
if ($page) {
return sprintf(‘%s‘, $page->CMSEditLink(), $page->Title);
}
return ‘(no page)’;
}
));

$dataColumns->setDisplayFields(array(
‘PageLink’ => ‘Page link’,
‘Name’ => ‘Content Block Parameter Name’,
‘Num’ => ‘Reference count’
));

$fields->insertAfter($gridField, ‘Notes’);

// prevent default action on going to ContentBlockParameter edit from on click. This means when
// the user clicks the page hyperlink they go to the page edit form
$script = “jQuery(‘.col-PageLink’).click(function(event) { event.stopImmediatePropagation(); });”;
Requirements::customScript($script);
}