mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
BUGFIX Added DocumentationPage->getRelativeLink(), which opposing to getRelativePath() excludes the extension
This commit is contained in:
parent
652f7c3898
commit
e0c8b6e9e0
@ -108,7 +108,7 @@ class DocumentationPage extends ViewableData {
|
||||
*/
|
||||
function Link() {
|
||||
if($entity = $this->getEntity()) {
|
||||
$link = Controller::join_links($entity->Link($this->version, $this->lang), $this->getRelativePath());
|
||||
$link = Controller::join_links($entity->Link($this->version, $this->lang), $this->getRelativeLink());
|
||||
|
||||
$link = rtrim(DocumentationService::trim_extension_off($link), '/');
|
||||
|
||||
@ -125,6 +125,22 @@ class DocumentationPage extends ViewableData {
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative to the module base, not the webroot
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getRelativeLink() {
|
||||
$link = rtrim(DocumentationService::trim_extension_off($this->getRelativePath()), '/');
|
||||
|
||||
// folders should have a / on them. Looks nicer
|
||||
try {
|
||||
if(is_dir($this->getPath())) $link .= '/';
|
||||
} catch (Exception $e) {};
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
function setFullPath($path) {
|
||||
$this->fullPath = $path;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user