mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
Merge pull request #99 from webbuilders-group/duplicate-home-fix
BUGFIX: Fixed duplicate Home links appearing
This commit is contained in:
commit
405af6b377
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -710,4 +710,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…
Reference in New Issue
Block a user