-
-
Save dljoseph/ac06fde8bfee26c6be7d8e17b9d2eec2 to your computer and use it in GitHub Desktop.
SilverStripe custom admin base url fix for ReportAdmin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ReportAdmin: | |
extensions: | |
- 'ReportAdminExtension' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ReportAdminExtension extends Extension { | |
public function updateEditForm($form) { | |
$gridField = $form->Fields()->dataFieldByName('Reports'); | |
if ($gridField instanceof GridField) { | |
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns'); | |
$columns->setFieldFormatting(array( | |
'title' => function($value, &$item) { | |
$link = Controller::join_links( | |
Config::inst()->get('AdminRootController', 'url_base'), | |
Config::inst()->get('ReportAdmin', 'url_segment'), | |
get_class($item) | |
); | |
return sprintf( | |
'<a href="%s" class="cms-panel-link">%s</a>', | |
Convert::raw2xml($link), | |
Convert::raw2xml($value) | |
); | |
} | |
)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment