mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
ENHANCEMENT: if viewing site on current version, do not include version in the parsed links
This commit is contained in:
parent
762eb2323b
commit
cb19549a97
@ -234,8 +234,8 @@ class DocumentationEntity extends ViewableData {
|
||||
}
|
||||
|
||||
function getRelativeLink($version = false, $lang = false) {
|
||||
if(!$version) $version = $this->getLatestVersion();
|
||||
if(!$lang) $lang = 'en';
|
||||
if($version == $this->getLatestVersion()) $version = false;
|
||||
|
||||
return Controller::join_links(
|
||||
DocumentationViewer::get_link_base(),
|
||||
|
@ -33,6 +33,9 @@ class DocumentationPageTest extends SapphireTest {
|
||||
|
||||
// test with version.
|
||||
$entity = DocumentationService::register("versionlinks", BASE_PATH . "/sapphiredocs/tests/docs-v2.4/", '1');
|
||||
$entity->addVersion('2', BASE_PATH . "/sapphiredocs/tests/docs-v3.0/");
|
||||
$entity->setLatestVersion('2');
|
||||
|
||||
$page = new DocumentationPage();
|
||||
$page->setRelativePath('test.md');
|
||||
$page->setEntity($entity);
|
||||
|
Loading…
Reference in New Issue
Block a user