Skip to content

Commit

Permalink
Revert "made navigation viewhelper always inject it's data into plugins"
Browse files Browse the repository at this point in the history
This reverts commit 56ff56c.
  • Loading branch information
zolex committed Aug 30, 2012
1 parent ec5ceea commit 6b073df
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions library/Zend/View/Helper/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ class Navigation extends AbstractNavigationHelper
*/
protected $defaultProxy = 'menu';

/**
* Indicates whether or not a given helper has been injected
*
* @var array
*/
protected $injected = array();

/**
* Whether container should be injected when proxying
*
Expand Down Expand Up @@ -183,7 +190,11 @@ public function findHelper($proxy, $strict = true)
$helper = $plugins->get($proxy);
$class = get_class($helper);

$this->inject($helper);
if (!isset($this->injected[$class])) {
$this->inject($helper);
$this->injected[$class] = true;
}

return $helper;
}

Expand All @@ -196,16 +207,20 @@ public function findHelper($proxy, $strict = true)
*/
protected function inject(NavigationHelper $helper)
{
if ($this->getInjectContainer()) {
if ($this->getInjectContainer() && !$helper->hasContainer()) {
$helper->setContainer($this->getContainer());
}

if ($this->getInjectAcl()) {
$helper->setAcl($this->getAcl());
$helper->setRole($this->getRole());
if (!$helper->hasAcl()) {
$helper->setAcl($this->getAcl());
}
if (!$helper->hasRole()) {
$helper->setRole($this->getRole());
}
}

if ($this->getInjectTranslator()) {
if ($this->getInjectTranslator() && !$helper->hasTranslator()) {
$helper->setTranslator(
$this->getTranslator(), $this->getTranslatorTextDomain()
);
Expand Down

0 comments on commit 6b073df

Please sign in to comment.