Frank Brückner wrote:
> 
> // Element
> $form->addElement(
>      'text',
>      'foo',
>      array(
>          'label'       => 'Foo',
>          'description' => 'Foobar...',
>          'decorators'  => array(
>              array(
>                  // Decorator name
>                  'Callback',
>                  // Decorator options
>                  array(
>                      'callback' => function($content, $element, array  
> $options)
>                      {
>                          // Add and setup view helper decorator
>                          $element->addDecorator('ViewHelper');
> 
>                          $viewHelper =
> $element->getDecorator('ViewHelper');
>                          $viewHelper->setElement($element);
> 
>                          // Label
>                          $html = '<div><label for="' . $element->getId()
>                                                      . '">'
>                                                      .
> $element->getLabel()
>                                                      . '</label></div>';
>                          // Element
>                          $html .= '<div>' . $viewHelper->render('') . '<br  
> />';
> 
>                          // Description
>                          $html .= $element->getDescription() . '</div>';
> 
>                          return $html;
>                      },
>                  )
>              ),
>          ),
>      )
> );
> 
> 

Best troll post ever! Not at all over engineered and very simple - lol!

monk.e.boy


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Over-engineered-Zend-Form-Decorators-help-tp3850650p3877451.html
Sent from the Zend Framework mailing list archive at Nabble.com.

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to