I've got a View, SE_View_Helper_FormText, that extends
Zend_View_Helper_FormText.
In the bootstrap, I've got the following code:
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->initView(null, "Site_View");
$viewRenderer->view->addHelperPath('SE/View/Helper', 'SE_View_Helper');
When I'm calling in my createAction $this->view->getHelperPaths(), I'm
getting the following result:
Array
(
[0] => Array
(
[prefix] => Zend_View_Helper_
[dir] =>
/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/application/v1/private/system_mvc/views/helpers/
)
[1] => Array
(
[prefix] => SE_View_Helper_
[dir] => SE/View/Helper/
)
[2] => Array
(
[prefix] => Site_View_Helper_
[dir] => ./views/helpers/
)
[3] => Array
(
[prefix] => Zend_View_Helper_
[dir] =>
/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/
)
)
When calling $this->view->getHelperPath("FormText") before calling
$this->render("item/form", null, true); in the createAction, then I get as
response "SE/View/Helper/FormText.php".
After the render, the response of $this->view->getHelperPath("FormText") =
"SE/View/Helper/FormText.php". And the form is correctly processed with the
SE_View_Helper_FormText helper.
Now, When I don't call $this->view->getHelperPath("FormText"), before
calling $this->render, the SE_View_Helper_FormText isn't used.
When calling $this->view->getHelperPath("FormText") after the render, I'm
getting
"/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/FormText.php"
as a response instead of "SE/View/Helper/FormText.php".
When I'm going to Form.php to the method getView(), I'm falling in the if
statement ( if (null === $this->_view) ).
I added a few lines:
public function getView()
{
if (null === $this->_view) {
require_once 'Zend/Controller/Action/HelperBroker.php';
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$this->_view = $viewRenderer->view;
//Show available helperPaths
echo "<pre>";
print_r($viewRenderer->view->getHelperPaths());
echo "</pre><hr>";
//Show helperPath for FormText
echo "<pre>";
print_r($viewRenderer->view->getHelperPath("FormText"));
echo "</pre><hr>";
}
return $this->_view;
}
As response, I'm getting this:
Array
(
[0] => Array
(
[prefix] => Zend_View_Helper_
[dir] =>
/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/application/v1/private/system_mvc/views/helpers/
)
[1] => Array
(
[prefix] => SE_View_Helper_
[dir] => SE/View/Helper/
)
[2] => Array
(
[prefix] => Site_View_Helper_
[dir] => ./views/helpers/
)
[3] => Array
(
[prefix] => Zend_View_Helper_
[dir] =>
/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/
)
)
----------------------------------------------
/home/httpd/vhosts/domain.com/subdomains/cms2008/httpdocs/library/Zend-1.5.3/View/Helper/FormText.php
You see here that the path for SE_View_Helper is known, but the wrong view
helper is taken.
Does somebody know a solution for this problem? It seems that it is similiar
like this
http://www.nabble.com/Troubleshooting-view-helpers---custom-prefix-doesn%27t-stay-td12276307.html#a12276307.
Thanks in advance!
--
View this message in context:
http://www.nabble.com/Wrong-view-helper-used-in-Form-tp19085095p19085095.html
Sent from the Zend Framework mailing list archive at Nabble.com.