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


PHP Form::setName方法代码示例

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


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

示例1: setName

 /**
  * {@inheritDoc}
  */
 public function setName($name)
 {
     parent::setName($name);
     if ($this->has($this->getCaptchaElementName())) {
         $element = $this->get($this->getCaptchaElementName());
         $this->captchaElementName = null;
         $name = $element->getName();
         $newName = $this->getCaptchaElementName();
         $flags['priority'] = $this->iterator->toArray(PriorityList::EXTR_PRIORITY)[$name];
         $this->remove($name);
         $element->setName($newName);
         $this->add($element, $flags);
     }
     if ($this->has($this->getCsrfElementName())) {
         $element = $this->get($this->getCsrfElementName());
         $this->csrfElementName = null;
         $name = $element->getName();
         $newName = $this->getCsrfElementName();
         $flags['priority'] = $this->iterator->toArray(PriorityList::EXTR_PRIORITY)[$name];
         $this->remove($name);
         $element->getCsrfValidator()->setName($newName);
         $element->setName($newName);
         $this->add($element, $flags);
     }
     return $this;
 }
开发者ID:coolms,项目名称:common,代码行数:29,代码来源:Form.php

示例2: addSubForm

 /**
  * Add a form group/subform
  *
  * @param  Form $form
  * @param  string $name
  * @param  int $order
  * @return Form
  */
 public function addSubForm(Form $form, $name, $order = null)
 {
     $name = (string) $name;
     foreach ($this->_loaders as $type => $loader) {
         $loaderPaths = $loader->getPaths();
         foreach ($loaderPaths as $prefix => $paths) {
             foreach ($paths as $path) {
                 $form->addPrefixPath($prefix, $path, $type);
             }
         }
     }
     if (!empty($this->_elementPrefixPaths)) {
         foreach ($this->_elementPrefixPaths as $spec) {
             list($prefix, $path, $type) = array_values($spec);
             $form->addElementPrefixPath($prefix, $path, $type);
         }
     }
     if (!empty($this->_displayGroupPrefixPaths)) {
         foreach ($this->_displayGroupPrefixPaths as $spec) {
             list($prefix, $path) = array_values($spec);
             $form->addDisplayGroupPrefixPath($prefix, $path);
         }
     }
     if (null !== $order) {
         $form->setOrder($order);
     }
     if (($oldName = $form->getName()) && $oldName !== $name && $oldName === $form->getElementsBelongTo()) {
         $form->setElementsBelongTo($name);
     }
     $form->setName($name);
     $this->_subForms[$name] = $form;
     $this->_order[$name] = $order;
     $this->_orderUpdated = true;
     return $this;
 }
开发者ID:rikaix,项目名称:zf2,代码行数:43,代码来源:Form.php

示例3: testAction

 public function testAction()
 {
     /*$form = new CreateProduct();
       $product = new Product();
       $form->bind($product);*/
     $form = new \Zend\Form\Form();
     $marketJurisdictions = $this->getEntityManager()->getRepository('GDI\\Entity\\RMarketJurisdiction')->findByMarket('1');
     //var_dump($marketJurisdiction);
     //exit;
     foreach ($marketJurisdictions as $marketJurisdiction) {
         //var_dump($marketJurisdiction->getJurisdiction());
         $jurisAbbr = $marketJurisdiction->getJurisdiction()->getJurisdictionAbbr();
         $form->setName('jurisdictionProduct');
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eSubmissionDate' . $jurisAbbr, 'options' => array('label' => 'Submission (Estimated)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eApprovalDate' . $jurisAbbr, 'options' => array('label' => 'Approval (Estimated)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eReleaseDate' . $jurisAbbr, 'options' => array('label' => 'Master Release (Estimated)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eLaunchDate' . $jurisAbbr, 'options' => array('label' => 'Launch (Estimated)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'eRegulatorDate' . $jurisAbbr, 'options' => array('label' => 'Regulator (Estimated)')));
         // result
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rSubmissionDate' . $jurisAbbr, 'options' => array('label' => 'Submission (Result)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rApprovalDate' . $jurisAbbr, 'options' => array('label' => 'Approval (Result)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rReleaseDate' . $jurisAbbr, 'options' => array('label' => 'Master Release (Result)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rLaunchDate' . $jurisAbbr, 'options' => array('label' => 'Launch (Result)')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => 'rRegulatorDate' . $jurisAbbr, 'options' => array('label' => 'Regulator (Result)')));
     }
     /*$subForm = new \Zend\Form\Form();
             $subForm->setName('subform');
     
             $subForm->add(array(
                 'name' => 'email',
                 'type' => 'Zend\Form\Element\Text',
             ));*/
     $request = $this->getRequest();
     if ($request->isPost()) {
         $form->setData($request->getPost());
         if ($form->isValid()) {
             //var_dump($product);
         }
     }
     $view = new ViewModel(array('form' => $form, 'marketJurisdictions' => $marketJurisdictions));
     $view->setTemplate('GDI/Index2/productForm2.phtml');
     // path to phtml file under view folder
     return $view;
 }
开发者ID:jonathan1212,项目名称:zend-tutorial,代码行数:44,代码来源:Index2Controller.php


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