Skip to content

Instantly share code, notes, and snippets.

@katzueno
Forked from hissy/PermissionSitemap.php
Last active June 9, 2016 12:14
Show Gist options
  • Save katzueno/fc314afdce63c5164f3f10493f86b554 to your computer and use it in GitHub Desktop.
Save katzueno/fc314afdce63c5164f3f10493f86b554 to your computer and use it in GitHub Desktop.
#concrete5 #version7 Show Permission Inheritance on Sitemap dynatree
<?php
// Add below line to application/bootstrap/app.php
Core::bind('helper/concrete/dashboard/sitemap', 'Application\Src\Application\Service\Dashboard\PermissionSitemap');
<?php
// Upload this file to application/src/Application/Service/Dashboard/PermissionSitemap.php
namespace Application\Src\Application\Service\Dashboard;
use Page;
class PermissionSitemap extends \Concrete\Core\Application\Service\Dashboard\Sitemap
{
public function getNode($cItem, $includeChildren = true, $onGetNode = null)
{
$node = parent::getNode($cItem, $includeChildren, $onGetNode);
$c = Page::getByID($node->cID, 'RECENT');
if (!$c->isError()) {
$inheritance = $c->getCollectionInheritance();
switch ($inheritance) {
case 'TEMPLATE':
$inheritance = t("PageType");
$node->title = '<span style="color:blue">' . $node->title . ' (' . $inheritance . ')</span>';
break;
case 'OVERRIDE':
$inheritance = t("Manual");
$node->title = '<span style="color:red">' . $node->title . ' (' . $inheritance . ')</span>';
break;
case 'PARENT':
break;
}
}
return $node;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment