當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Form_SubForm::setDefaults方法代碼示例

本文整理匯總了PHP中Zend_Form_SubForm::setDefaults方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Form_SubForm::setDefaults方法的具體用法?PHP Zend_Form_SubForm::setDefaults怎麽用?PHP Zend_Form_SubForm::setDefaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Form_SubForm的用法示例。


在下文中一共展示了Zend_Form_SubForm::setDefaults方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setDefaults

 /**
  * Override setDefaults to dynamically generate elements
  * @param array $defaults
  */
 public function setDefaults($defaults)
 {
     $subform = $this->getSubForm('current');
     foreach ($defaults['current'] as $id => $values) {
         $subform->addElement($this->createTaskElement($id, $values));
     }
     // set defaults, which will propagate to newly created subforms & elements
     parent::setDefaults($defaults);
 }
開發者ID:TBeijen,項目名稱:Zend_Form_Dynamic,代碼行數:13,代碼來源:My_SubForm_TaskDay.php

示例2: initForm

 /**
  */
 public function initForm(Zend_Form $form, ListView $list, MemberView $member = null)
 {
     $newsletter = new Zend_Form_SubForm();
     $newsletter->addElement('checkbox', 'subscriber', array('label' => 'I want to receive newsletter'));
     foreach ($list->groups as $group) {
         $type = $group['form_field'] == 'radio' ? 'radio' : 'multiCheckbox';
         $newsletter->addElement($type, $group['name'], array('label' => $group['name'], 'multioptions' => $group['groups']));
     }
     if ($member !== null) {
         $newsletter->setDefaults(array_merge((array) $member, $member->groups));
     }
     $form->addSubForm($newsletter, 'newsletter');
 }
開發者ID:sourcefabric,項目名稱:newscoop,代碼行數:15,代碼來源:Newsletter.php

示例3: setDefaults

 /**
  * Przeciążenie setDefaults, żeby uwzględniało prefixy w filtrach
  *
  * @return Zend_Form
  */
 public function setDefaults(array $defaults)
 {
     if ($this->filteredData && isset($defaults[$this->filteredData])) {
         $defaults = $defaults[$this->filteredData];
     }
     return parent::setDefaults($defaults);
 }
開發者ID:knatorski,項目名稱:SMS,代碼行數:12,代碼來源:Abstract.php

示例4: addUserAttributesSubForm

 /**
  * Add user attributes subform to form
  *
  * @param  Zend_Form            $form
  * @param  Newscoop\Entity\User $user
  * @return void
  */
 private function addUserAttributesSubForm(Zend_Form $form, User $user)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend($translator->trans('User attributes', array(), 'users'));
     foreach ($user->getRawAttributes() as $key => $val) {
         $subForm->addElement('text', $key, array('label' => $key));
     }
     $subForm->setDefaults($user->getAttributes());
     $form->addSubForm($subForm, 'attributes');
 }
開發者ID:sourcefabric,項目名稱:newscoop,代碼行數:18,代碼來源:UserController.php


注:本文中的Zend_Form_SubForm::setDefaults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。