当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_SubForm::setElementDecorators方法代码示例

本文整理汇总了PHP中Zend_Form_SubForm::setElementDecorators方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_SubForm::setElementDecorators方法的具体用法?PHP Zend_Form_SubForm::setElementDecorators怎么用?PHP Zend_Form_SubForm::setElementDecorators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_SubForm的用法示例。


在下文中一共展示了Zend_Form_SubForm::setElementDecorators方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $this->setAttrib('id', 'customAttribute');
     // Create and configure username element:
     $label = $this->createElement('text', 'label', array('label' => 'Label:'));
     $label->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags');
     $description = $this->createElement('text', 'description', array('label' => 'Description:'));
     $description->addFilter('StringTrim')->addFilter('StripTags');
     $required = $this->createElement('select', 'required', array('label' => 'Required?'));
     $required->setRequired(true)->setMultiOptions(array('1' => 'Yes', '0' => 'No'))->setAllowEmpty(false);
     $rowCt = $this->createElement('hidden', 'rowCt');
     $rowCt->setValue($this->_numberOfOptions);
     $rowCt->setDecorators(array('ViewHelper'));
     $this->addElements(array($label, $description, $required, $rowCt));
     if ($this->_numberOfOptions != 0) {
         $container = new Zend_Form_SubForm();
         $container->setDescription('Options:');
         $container->setDecorators(array(array('Description', array('tag' => 'label', 'class' => 'control-label')), array('FormElements'), array(array('controlsWrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'control-group', 'id' => 'optionElement'))));
         $container->setElementDecorators(array('ViewHelper', 'FormElements'));
         $this->addSubForm($container, 'options');
         for ($i = 0; $i < $this->_numberOfOptions; $i++) {
             $optionSubform = new Ot_Form_CustomAttributeOption();
             $container->addSubForm($optionSubform, $i);
         }
         $this->addElement('button', 'addElement', array('buttonType' => Twitter_Bootstrap_Form_Element_Submit::BUTTON_SUCCESS, 'label' => 'Add Option', 'icon' => 'plus', 'whiteIcon' => true, 'iconPosition' => Twitter_Bootstrap_Form_Element_Button::ICON_POSITION_LEFT));
     }
     $this->addElement('submit', 'submit', array('buttonType' => Twitter_Bootstrap_Form_Element_Submit::BUTTON_PRIMARY, 'label' => 'Save Attribute'));
     $this->addElement('button', 'cancel', array('label' => 'form-button-cancel', 'type' => 'button'));
     $this->addDisplayGroup(array('submit', 'cancel'), 'actions', array('disableLoadDefaultDecorators' => true, 'decorators' => array('Actions')));
     return $this;
 }
开发者ID:ncsuwebdev,项目名称:otframework,代码行数:31,代码来源:CustomAttribute.php

示例2: init

 public function init()
 {
     $this->setName('addApplicant');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $product = new Zend_Form_Element_Text('product');
     $product->setLabel('* product:')->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $category = new Zend_Form_Element_Text('category');
     $category->setLabel("* category:")->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $group = new Zend_Form_Element_Text('group');
     $group->setLabel("* group:")->setRequired(true)->addFilter('StripTags')->addFilter('stringTrim')->addValidators(array(array('regex', false, array('pattern' => "/^[а,б,в,г,ґ,д,е,є,ж,з,и,ы,і,ї,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ь,ю,я,А,Б,В,С,Г,Д,Е,Є,Ж,З,И,Ы,І,Ї,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ь,Ю,Я,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z,1,2,3,4,5,6,7,8,9,0'.]{2,}\$/", 'messages' => 'В полі присутні заборонені символи!!'))));
     $this->addElements(array($id, $product, $category, $group));
     //-------------------- add attr
     $institutions = new Zend_Form_SubForm();
     $institutions->setName('attr');
     $session = new Zend_Session_Namespace('form');
     foreach ($session->attr as $inst) {
         $rowForm = new Zend_Form_SubForm();
         $rowForm->setName($inst);
         if ($inst === '__template1__') {
             $rowForm->setAttrib('style', 'display: none;');
         }
         $instName = new Zend_Form_Element_Text('instName');
         $instName->setLabel('attribute')->addFilter('StripTags')->addFilter('stringTrim')->setAttrib('class', 'institution')->setAttrib('onfocus', 'institutionAutocomplete(this)');
         if ($inst !== '__template1__') {
             $instName->setRequired(true);
         }
         $inst_remove = new Zend_Form_Element_Button('remove');
         $inst_remove->setLabel('remove')->setAttrib('class', 'remove')->setAttrib('onclick', 'removeInst(this)');
         $elements = array($instName, $inst_remove);
         foreach ($elements as $element) {
             if ($inst !== '__template1__' && $element->getName() !== 'remove') {
                 $element->setRequired(true);
             }
         }
         $rowForm->addElements($elements);
         $rowForm->setElementDecorators($this->getElementDecorators());
         $rowForm->getElement('remove')->removeDecorator('Label');
         $rowForm->setDecorators($this->getSubFormDecorators());
         $institutions->addSubForm($rowForm, $inst);
     }
     $institutions->setDecorators($this->getSubFormDecorators());
     $inst_add = new Zend_Form_Element_Button('addInst');
     $inst_add->setLabel('add attribute')->setAttrib('class', 'addInst');
     $institutions->addElement($inst_add);
     $institutions->setElementDecorators($this->getElementDecorators());
     $institutions->getElement('addInst')->removeDecorator('Label');
     $this->addSubForm($institutions, 'institutions');
     $this->postSetup();
 }
开发者ID:varrbor,项目名称:hanuka.lviv.ua,代码行数:50,代码来源:SubForm.php


注:本文中的Zend_Form_SubForm::setElementDecorators方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。