mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
BUGFIX: Fixed duplicate Home links appearing
Added support for a home link in the menu when there is no default entity
This commit is contained in:
parent
d5f53864d7
commit
d0fd100b79
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,14 @@
|
||||
$DocumentationSearchForm
|
||||
|
||||
<ul class="nav">
|
||||
<% if not HasDefaultEntity %>
|
||||
<li><a href="$Link" class="top">Home</a></li>
|
||||
<% end_if %>
|
||||
|
||||
<% loop Menu %>
|
||||
<li><a href="$Link" class="top">Home</a></li>
|
||||
<% if DefaultEntity %>
|
||||
<li><a href="$Link" class="top">Home</a></li>
|
||||
|
||||
<% loop Children %>
|
||||
<li class="$LinkingMode <% if Last %>last<% end_if %>">
|
||||
<a href="$Link" class="top">$Title</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user