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;
|
private $entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $has_default_entity = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
@ -157,6 +162,9 @@ class DocumentationManifest
|
|||||||
|
|
||||||
if (isset($details['DefaultEntity'])) {
|
if (isset($details['DefaultEntity'])) {
|
||||||
$entity->setIsDefaultEntity($details['DefaultEntity']);
|
$entity->setIsDefaultEntity($details['DefaultEntity']);
|
||||||
|
if ($entity->getIsDefaultEntity()) {
|
||||||
|
$this->has_default_entity = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->registeredEntities->push($entity);
|
$this->registeredEntities->push($entity);
|
||||||
@ -760,4 +768,13 @@ class DocumentationManifest
|
|||||||
|
|
||||||
return $versions;
|
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');
|
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
|
$DocumentationSearchForm
|
||||||
|
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
|
<% if not HasDefaultEntity %>
|
||||||
|
<li><a href="$Link" class="top">Home</a></li>
|
||||||
|
<% end_if %>
|
||||||
|
|
||||||
<% loop Menu %>
|
<% loop Menu %>
|
||||||
<li><a href="$Link" class="top">Home</a></li>
|
|
||||||
<% if DefaultEntity %>
|
<% if DefaultEntity %>
|
||||||
|
<li><a href="$Link" class="top">Home</a></li>
|
||||||
|
|
||||||
<% loop Children %>
|
<% loop Children %>
|
||||||
<li class="$LinkingMode <% if Last %>last<% end_if %>">
|
<li class="$LinkingMode <% if Last %>last<% end_if %>">
|
||||||
<a href="$Link" class="top">$Title</a>
|
<a href="$Link" class="top">$Title</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user