Skip to content

Commit

Permalink
Added filtering by Famelo.Features if installed
Browse files Browse the repository at this point in the history
Change-Id: Iad464524c637bfa40bc9c190b68c7cb73963c1c6
  • Loading branch information
Marc Neuhaus committed Jan 28, 2013
1 parent 5800554 commit 7cd22a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Classes/Famelo/Navigation/ViewHelpers/NavigationViewHelper.php
Expand Up @@ -40,6 +40,11 @@ class NavigationViewHelper extends \TYPO3\Fluid\Core\ViewHelper\AbstractViewHelp
*/
protected $policyService;

/**
* @var \Famelo\Features\FeatureService
*/
protected $featureService;

/**
* @param string $path
* @param string $as
Expand All @@ -49,6 +54,10 @@ class NavigationViewHelper extends \TYPO3\Fluid\Core\ViewHelper\AbstractViewHelp
public function render($path = NULL, $as = 'items', $nested = TRUE) {
$routes = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_ROUTES);

if (class_exists('\Famelo\Features\FeatureService')) {
$this->featureService = new \Famelo\Features\FeatureService();
}

$items = $this->parseRoutes($routes);

if ($nested || TRUE) {
Expand Down Expand Up @@ -86,6 +95,12 @@ public function parseRoutes($routes) {
continue;
}

if ($this->featureService !== NULL && isset($route['feature'])) {
if ($this->featureService->isFeatureActive($route['feature']) === FALSE) {
continue;
}
}

$items[] = $item;
}
}
Expand Down

0 comments on commit 7cd22a6

Please sign in to comment.