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


PHP Fieldset::prepareElement方法代碼示例

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


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

示例1: prepareElement

 /**
  * Prepare the collection by adding a dummy template element if the user want one
  *
  * @param  FormInterface $form
  * @return mixed|void
  */
 public function prepareElement(FormInterface $form)
 {
     if (true === $this->shouldCreateChildrenOnPrepareElement) {
         if ($this->targetElement !== null && $this->count > 0) {
             while ($this->count > $this->lastChildIndex + 1) {
                 $this->addNewTargetElementInstance(++$this->lastChildIndex);
             }
         }
     }
     // Create a template that will also be prepared
     if ($this->shouldCreateTemplate) {
         $templateElement = $this->getTemplateElement();
         $this->add($templateElement);
     }
     parent::prepareElement($form);
     // The template element has been prepared, but we don't want it to be rendered nor validated, so remove it from the list
     if ($this->shouldCreateTemplate) {
         $this->remove($this->templatePlaceholder);
     }
 }
開發者ID:ErR163,項目名稱:torrentpier,代碼行數:26,代碼來源:Collection.php

示例2: prepareElement

 /**
  * Prepare the collection by adding a dummy template element if the user want one
  *
  * @param  FormInterface $form
  * @return mixed|void
  */
 public function prepareElement(FormInterface $form)
 {
     // Create a template that will also be prepared
     if ($this->shouldCreateTemplate) {
         $templateElement = $this->getTemplateElement();
         $this->add($templateElement);
     }
     parent::prepareElement($form);
     // The template element has been prepared, but we don't want it to be rendered nor validated, so remove it from the list
     if ($this->shouldCreateTemplate) {
         $this->remove($this->templatePlaceholder);
     }
 }
開發者ID:leonardovn86,項目名稱:zf2_basic2013,代碼行數:19,代碼來源:Collection.php

示例3: prepareElement

 /**
  * Prepare the collection by adding a dummy template element if the user want one
  *
  * @param  FormInterface $form
  * @return mixed|void
  */
 public function prepareElement(FormInterface $form)
 {
     if (true === $this->shouldCreateChildrenOnPrepareElement) {
         if ($this->targetElement !== null && $this->count > 0) {
             $applyNames = count($this->keyNames) > 0 && count($this->keyNames) === $this->count ? 1 : 0;
             while ($this->count > $this->lastChildIndex + 1) {
                 $label = isset($this->labels[$this->lastChildIndex + 1]) ? $this->labels[$this->lastChildIndex + 1] : null;
                 $this->addNewTargetElementInstance($applyNames ? $this->keyNames[++$this->lastChildIndex] : ++$this->lastChildIndex, $label);
             }
         }
     }
     // Create a template that will also be prepared
     if ($this->shouldCreateTemplate) {
         $templateElement = $this->getTemplateElement();
         $this->add($templateElement);
     }
     parent::prepareElement($form);
     // The template element has been prepared, but we don't want it to be
     // rendered nor validated, so remove it from the list.
     if ($this->shouldCreateTemplate) {
         $this->remove($this->templatePlaceholder);
     }
 }
開發者ID:serus22,項目名稱:zend-form,代碼行數:29,代碼來源:Collection.php


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