Skip to content

Commit

Permalink
Minor bugfixes
Browse files Browse the repository at this point in the history
[Fixed] Issue where using any of the startWith parameters were returning full nav if the node was not included.
[Fixed] Issue with deleted assets breaking front-end output.
  • Loading branch information
michaelfromtheoutfit committed Aug 16, 2016
1 parent ecf0f9f commit b96db9e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NaveePlugin.php
Expand Up @@ -10,7 +10,7 @@ public function getName()

public function getVersion()
{
return '1.0.8';
return '1.0.9';
}

public function getDeveloper()
Expand Down
9 changes: 9 additions & 0 deletions releases.json
@@ -1,4 +1,13 @@
[
{
"version": "1.0.9",
"downloadUrl": "https://github.com/fromtheoutfit/navee/archive/v1.0.9.zip",
"date": "2016-08-16T09:32:00-05:00",
"notes": [
"[Fixed] Issue where using any of the startWith parameters were returning full nav if the node was not included.",
"[Fixed] Issue with deleted assets breaking front-end output."
]
},
{
"version": "1.0.8",
"downloadUrl": "https://github.com/fromtheoutfit/navee/archive/v1.0.8.zip",
Expand Down
26 changes: 24 additions & 2 deletions services/NaveeService.php
Expand Up @@ -127,8 +127,16 @@ public function setLink(Navee_NodeModel $node)
break;
case 'assetId':
$file = craft()->assets->getFileById($node->assetId);
$sourceType = craft()->assetSources->getSourceTypeById($file->sourceId);
$node->link = AssetsHelper::generateUrl($sourceType, $file);
if ($file)
{
$sourceType = craft()->assetSources->getSourceTypeById($file->sourceId);
$node->link = AssetsHelper::generateUrl($sourceType, $file);
}
else
{
$node->link = '';
}

break;
}

Expand Down Expand Up @@ -401,6 +409,20 @@ private function getSubsetOfNodes($nodes, $activeNodes)
$this->config->maxDepth = $activeNode->level + $this->config->maxDepth - 1;
}

}
else
{
// There are no active nodes - which means that we should return an empty array
// if any of the parameters that are dependant on an active node have been passed
if ($this->config->startWithActive ||
$this->config->startWithAncestorOfActive ||
$this->config->startWithChildrenOfActive ||
$this->config->startWithSiblingsOfActive ||
$this->config->startXLevelsAboveActive)
{
return array();
}

}

foreach ($nodes as $k => $node)
Expand Down

0 comments on commit b96db9e

Please sign in to comment.