From d0fd100b79206ffa20ebe704332b25eda4fb33ec Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Mon, 22 Feb 2016 12:01:38 -0400 Subject: [PATCH] BUGFIX: Fixed duplicate Home links appearing Added support for a home link in the menu when there is no default entity --- code/DocumentationManifest.php | 17 +++++++++++++++++ code/controllers/DocumentationViewer.php | 10 ++++++++++ templates/Includes/DocumentationSidebar.ss | 8 ++++++-- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/code/DocumentationManifest.php b/code/DocumentationManifest.php index bba6692..0ac074a 100644 --- a/code/DocumentationManifest.php +++ b/code/DocumentationManifest.php @@ -61,6 +61,11 @@ class DocumentationManifest */ private $entity; + /** + * @var boolean + */ + private $has_default_entity = false; + /** * @var boolean */ @@ -157,6 +162,9 @@ class DocumentationManifest if (isset($details['DefaultEntity'])) { $entity->setIsDefaultEntity($details['DefaultEntity']); + if ($entity->getIsDefaultEntity()) { + $this->has_default_entity = true; + } } $this->registeredEntities->push($entity); @@ -760,4 +768,13 @@ class DocumentationManifest return $versions; } + + /** + * Gets whether there is a default entity or not + * @return boolean + */ + public function getHasDefaultEntity() + { + return $this->has_default_entity; + } } diff --git a/code/controllers/DocumentationViewer.php b/code/controllers/DocumentationViewer.php index 2817677..7eedc08 100755 --- a/code/controllers/DocumentationViewer.php +++ b/code/controllers/DocumentationViewer.php @@ -709,4 +709,14 @@ class DocumentationViewer extends Controller { return Config::inst()->get('DocumentationViewer', 'link_base'); } + + /** + * Gets whether there is a default entity or not + * @return boolean + * @see DocumentationManifest::getHasDefaultEntity() + */ + public function getHasDefaultEntity() + { + return $this->getManifest()->getHasDefaultEntity(); + } } diff --git a/templates/Includes/DocumentationSidebar.ss b/templates/Includes/DocumentationSidebar.ss index 3ecc8bd..8150b73 100644 --- a/templates/Includes/DocumentationSidebar.ss +++ b/templates/Includes/DocumentationSidebar.ss @@ -3,10 +3,14 @@ $DocumentationSearchForm