Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
[New] Wayfinder - &startId=parent
Browse files Browse the repository at this point in the history
[[Wayfinder?startId=parent]]
  • Loading branch information
yama committed Aug 24, 2016
1 parent 65ffd4d commit dc298ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assets/snippets/wayfinder/wayfinder.inc.php
Expand Up @@ -342,6 +342,10 @@ function getData() {
global $modx;
$depth = !empty($this->_config['level']) ? $this->_config['level'] : 10;
$ids = array();

if(strtolower(substr($this->_config['id'],0,1))==='p')
$this->_config['id'] = $this->getParentID($modx->documentIdentifier);

if (!$this->_config['hideSubMenus']) {
$ids = $modx->getChildIds($this->_config['id'],$depth);
} else { // then hideSubMenus is checked, we don`t need all children
Expand Down Expand Up @@ -718,4 +722,10 @@ function hsc($string) {
global $modx;
return htmlspecialchars($string, ENT_COMPAT, $modx->config['modx_charset']);
}
function getParentID($id)
{
global $modx;
if($modx->documentObject['parent']==0) return $id;
return $modx->documentObject['parent'];
}
}

0 comments on commit dc298ce

Please sign in to comment.