View Single Post
  #1 (permalink)  
Old 05-08-2008, 03:20 PM
ablock ablock is offline
Junior Member
 
Join Date: Mar 2008
Posts: 6
Default Custom Form Element with custom ViewHelper

I would like to create a custom Form Element which is essentially a Textarea with some javascript to turn it into a WYSIWYG editor (using NicEditor). I thought the best way to do this would be would be something like this

PHP Code:
class Foo_View_Helper_FormNicEditor extends Zend_View_Helper_FormTextarea
{
    public function 
formNicEditor($name$value$value null$attribs null)
    {
         
$textarea $this->formTextarea($name$value$attribs);
         return ..........
    } 
   

and then in my custom Form Element to set
PHP Code:
pubic $helper 'formNicEditor' 
...the problem of course being that it doesn't know where to find this ViewHelper.

What I settled on do was overwriting the render method as follows:

PHP Code:
public function render(Zend_View_Interface $view null
{
         
$view $this->getView();
         
$view->setHelperPath('Foo/View/Helper''Chintion_View_Helper');
         return 
parent::render($view);

This works, but it doesn't feel right to me...
Reply With Quote