$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .
$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .$ this ->setElementDecorators(array( 'ViewHelper' , array( 'decorator' => array( 'br' => 'HtmlTag' ), 'options' => array( 'tag' => 'span' , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'tdOpen' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::PREPEND)), array( 'decorator' => array( 'tdClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'closeOnly' => true , 'placement' => Zend_Form_Decorator_Abstract::APPEND)), array( 'decorator' => array( 'label' => 'Label' ), 'options' => array( 'separator' => '*' )), 'Errors' , array( 'decorator' => array( 'mainCell' => 'HtmlTag' ), 'options' => array( 'tag' => 'td' , 'class' => 'tregleft' )), array( 'decorator' => array( 'mainRowClose' => 'HtmlTag' ), 'options' => array( 'tag' => 'tr' )) )); $usernameFieldLabel = $ this ->user_name->getDecorator( 'label' ); $defaultSeparator = $usernameFieldLabel->getOption( 'separator' ); $usernameFieldLabel->setOption( 'separator' , $defaultSeparator. '
"_".' ); * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- <? php
- require_once 'Zend / Form / Decorator / Abstract.php' ;
- class Zend_Form_Decorator_GroupDecorator extends Zend_Form_Decorator_Abstract {
- / **
- * Items (decorators) to group
- * @var array
- * /
- protected $ _items = null ;
- / **
- * Temporary form to perform decorators operations
- * @var Zend_Form_Element
- * /
- private $ _temporaryDecoratorsContainer = null ;
- / **
- * Constructor
- *
- * @param array | Zend_Config $ options
- * @return void
- * /
- public function __construct ($ options = null ) {
- parent :: __ construct ($ options);
- $ this -> _ temporaryDecoratorsContainer = new Zend_Form_Element ( '_temporaryDecoratorsContainer' , array ( 'DisableLoadDefaultDecorators' => true ));
- $ this -> getItems ();
- }
- / **
- * Set items to use
- *
- * @param array $ items
- * @return Zend_Form_Decorator_GroupDecorator
- * /
- public function setItems ($ items) {
- $ this -> _ items = $ this -> _ temporaryDecoratorsContainer-> clearDecorators () -> addDecorators ($ items) -> getDecorators ();
- return $ this ;
- }
- / **
- * Get tag
- *
- * If no items are registered, either through setItems () or as an option, uses empty array.
- *
- * @return array
- * /
- public function getItems () {
- if ( null === $ this -> _ items) {
- if ( null === ($ items = $ this -> getOption ( 'items' ))) {
- $ this -> setItems (array ());
- } else {
- $ this -> setItems ($ items);
- $ this -> removeOption ( 'items' );
- }
- }
- return $ this -> _ items;
- }
- public function addDecorator ($ decorator, $ options = null ) {
- $ this -> _ temporaryDecoratorsContainer-> addDecorator ($ decorator, $ options);
- return $ this ;
- }
- public function clearDecorators () {
- $ this -> _ temporaryDecoratorsContainer-> clearDecorators ();
- $ this -> _ items = array ();
- }
- public function getDecorator ($ index = null ) {
- if ( null === $ index) {
- return $ this -> _ items;
- }
- if (is_numeric ($ index)) {
- $ _items = array_values ($ this -> _ items);
- return ($ index <count ($ _ items))? $ _ items [$ index]: null ;
- }
- if (is_string ($ index)) {
- return (array_key_exists ($ index, $ this -> _ items))? $ this -> _ items [$ index]: null ;
- }
- return null ;
- }
- public function insertDecoratorBefore ($ index, $ decorator, $ options = null ) {
- $ _decoratorsToAdd = $ this -> _ temporaryDecoratorsContainer-> clearDecorators () -> addDecorator ($ decorator, $ options) -> getDecorators ();
- if (is_string ($ index)) {
- $ index = array_search ($ index, array_keys ($ this -> _ items));
- }
- if ( false ! == $ index) {
- $ first = ($ index> 0)? array_slice ($ this -> _ items, 0, $ index, true ): array ();
- $ last = ($ index <count ($ this -> _ items))? array_slice ($ this -> _ items, $ index, null , true ): array ();
- $ this -> _ items = array_merge ($ first, (array) $ _ decoratorsToAdd, $ last);
- }
- return $ this ;
- }
- / **
- * Render content wrapped in a group of decorators
- *
- * @param string $ content
- * @return string
- * /
- public function render ($ content) {
- $ placement = $ this -> getPlacement ();
- $ items = $ this -> getItems ();
- $ _content = '' ;
- foreach ($ items as $ _decorator) {
- if ($ _decorator instanceOf Zend_Form_Decorator_Interface) {
- $ _decorator-> setElement ($ this -> getElement ());
- $ _content = $ _decorator-> render ($ _ content);
- }
- else {
- require_once 'Zend / Form / Decorator / Exception.php' ;
- throw new Zend_Form_Decorator_Exception ( 'Invalid decorator' . $ _decorator. 'provided; must be string or Zend_Form_Decorator_Interface' );
- }
- }
- switch ($ placement) {
- case self :: APPEND:
- return $ content. $ _content;
- break ;
- case self :: PREPEND:
- return $ _content. $ content;
- break ;
- default :
- return $ _content. $ content. $ _ content;
- break ;
- }
- }
- }
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- class Form_MemberRegister extends Zend_Form {
- public function init () {
- $ this -> setDisableLoadDefaultDecorators ( true );
- $ this -> addDecorator ( 'FormElements' )
- -> addDecorator (array ( 'table' => 'HtmlTag' ), array ( 'tag' => 'table' , 'class' => 'treg' ))
- -> addDecorator ( 'Form' );
- $ this -> addElement ( 'text' , 'user_name' , array ( 'label' => 'Login:' ));
- $ this -> addElement ( 'password' , 'password' , array ( 'label' => 'Password:' ));
- $ this -> addElement ( 'password' , 'password2' , array ( 'label' => 'Repeat password:' ));
- $ this -> addElement ( 'text' , 'email' , array ( 'label' => 'E-mail:' ));
- $ this -> setElementDecorators (array (
- array ( 'decorator' => array ( 'labelGroup' => 'GroupDecorator' ), 'options' => array ( 'items' => array (
- array ( 'decorator' => 'Text' , 'options' => array ( 'text' => '*' )),
- array ( 'decorator' => array ( 'span' => 'HtmlTag' ), 'options' => array ( 'tag' => 'span' , 'class' => 'red' ))
- array ( 'decorator' => 'Label' , 'options' => array ( 'placement' => Zend_Form_Decorator_Abstract :: PREPEND)),
- array ( 'decorator' => array ( 'labelCell' => 'HtmlTag' ), 'options' => array ( 'tag' => 'td' , 'class' => 'tregleft' ))
- ))),
- array ( 'decorator' => array ( 'elementGroup' => 'GroupDecorator' ), 'options' => array ( 'items' => array (
- 'ViewHelper' ,
- array ( 'decorator' => array ( 'elementCell' => 'HtmlTag' ), 'options' => array ( 'tag' => 'td' ))
- )), 'placement' => Zend_Form_Decorator_Abstract :: APPEND),
- array ( 'decorator' => array ( 'mainRowClose' => 'HtmlTag' ), 'options' => array ( 'tag' => 'tr' ))
- ))
- / **
- * @var Zend_Form_Decorator_GroupDecorator
- * /
- $ usernameFieldLabel = $ this -> user_name-> getDecorator ( 'labelGroup' );
- $ usernameFieldLabel-> insertDecoratorBefore ( 'labelCell' , array ( 'usernameNotes' => $ this -> _ getNotesDecorator ($ this -> user_name, 'Login can consist only of Latin letters and the sign "_".' ))));
- / **
- * @var Zend_Form_Decorator_GroupDecorator
- * /
- $ emailFieldDecorator = $ this -> email-> getDecorator ( 'elementGroup' );
- $ emailFieldDecorator-> insertDecoratorBefore ( 'elementCell' , array ( 'emailNotes' => $ this -> _ getNotesDecorator ($ this -> email, ' Enter only existing and working e-mail. At this address you will be sent a link to confirm registration. ' )));
- }
- protected function _getNotesDecorator ($ element, $ notesText = '' ) {
- $ _d = new Zend_Form_Decorator_GroupDecorator (array ( 'items' => array (
- array ( 'decorator' => array ( 'notesText' => 'Text' ), 'options' => array ( 'text' => $ notesText)),
- array ( 'decorator' => array ( 'notesTag' => 'HtmlTag' ), 'options' => array ( 'tag' => 'small' )),
- array (
- 'decorator' => array ( 'br' => 'HtmlTag' ),
- 'options' => array ( 'tag' => 'br' , 'openOnly' => true , 'placement' => Zend_Form_Decorator_Abstract :: PREPEND)
- )
- )));
- return $ _d-> setElement ($ element);
- }
- }
- ?>
Source: https://habr.com/ru/post/42748/