34 lines
889 B
PHP
34 lines
889 B
PHP
<?php
|
|
/**
|
|
*
|
|
*/
|
|
class Fiktiv_Controller_Plugin_Navigation extends Zend_Controller_Plugin_Abstract
|
|
{
|
|
protected $_lang;
|
|
|
|
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
|
{
|
|
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
|
|
$navigtion = $bootstrap->getResource('nav');
|
|
|
|
$this->_lang = $request->getParam('lang');
|
|
|
|
// This can't be right?!
|
|
// TODO: Fix Zend_Navigation + route (:lang)
|
|
$this->setLangParam($navigtion);
|
|
}
|
|
|
|
protected function setLangParam($nav)
|
|
{
|
|
foreach($nav->getPages() as $page) {
|
|
|
|
$params = array_merge($page->getParams(), array('lang' => $this->_lang));
|
|
|
|
$page->setParams($params);
|
|
|
|
if ($page->hasChildren()) {
|
|
$this->setLangParam($page);
|
|
}
|
|
}
|
|
}
|
|
}
|