سؤال

i wrote own decorator in the app path like "library/myLib/Form/Decorator/Lalala.php"

now suppose to use it like $element->addDecorator('Lalala'); but get error:

Plugin by name 'Filechoose' was not found in the registry; used paths: Zend_Form_Decorator_: Zend/Form/Decorator/

how to set up default element decorator paths.

هل كانت مفيدة؟

المحلول

Assuming that your decorator class myLib_Form_Decorator_Lalala is stored in file library/myLib/Form/Decorator/Lalala.php, then we can do it as follows:

At the form level:

$form->addElementPrefixPath(APPLICATION_PATH . '/../library/myLib/Form/Decorator', 'myLib_Form_Decorator_', Zend_Form::DECORATOR);

At the element level:

$elt->addPrefixPath(APPLICATION_PATH . '/../library/myLib/Form/Decorator', 'myLib_Form_Decorator_', Zend_Form::DECORATOR);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top