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


PHP Form::setView方法代码示例

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


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

示例1: setView

 /**
  * Set the view object
  *
  * Ensures that the view object has the dojo view helper path set.
  *
  * @param  \Zend\View\ViewEngine $view
  * @return \Zend\Dojo\Form\Element\Dijit
  */
 public function setView(View $view = null)
 {
     if (null !== $view) {
         if (false === $view->getPluginLoader('helper')->getPaths('Zend\\Dojo\\View\\Helper')) {
             $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend\\Dojo\\View\\Helper');
         }
     }
     return parent::setView($view);
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:17,代码来源:Form.php

示例2: setView

 /**
  * Set the view object
  *
  * Ensures that the view object has the dojo view helper path set.
  *
  * @param  \Zend\View\Renderer $view
  * @return \Zend\Dojo\Form\Element\Dijit
  */
 public function setView(View $view = null)
 {
     if (null !== $view) {
         if (false === $view->getBroker()->isLoaded('dojo')) {
             $loader = new \Zend\Dojo\View\HelperLoader();
             $view->getBroker()->getClassLoader()->registerPlugins($loader);
         }
     }
     return parent::setView($view);
 }
开发者ID:RomanShumkov,项目名称:zf2,代码行数:18,代码来源:Form.php

示例3: setupForm

 public function setupForm()
 {
     $form1 = new SubForm();
     $form1->addElement('text', 'foo', array('label' => 'Sub Foo: ', 'required' => true, 'validators' => array('NotEmpty', 'Alpha')))->addElement('text', 'bar', array('label' => 'Sub Bar: ', 'required' => true, 'validators' => array('Alpha', 'Alnum')));
     $form2 = new Form();
     $form2->addElement('text', 'foo', array('label' => 'Master Foo: ', 'required' => true, 'validators' => array('NotEmpty', 'Alpha')))->addElement('text', 'bar', array('required' => true, 'validators' => array('Alpha', 'Alnum')))->addSubForm($form1, 'sub');
     $form2->isValid(array('foo' => '', 'bar' => 'foo 2 u 2', 'sub' => array('foo' => '', 'bar' => 'foo 2 u 2')));
     $form2->setView($this->getView());
     $this->decorator->setElement($form2);
     $this->form = $form2;
     return $form2;
 }
开发者ID:navtis,项目名称:xerxes-pazpar2,代码行数:12,代码来源:FormErrorsTest.php

示例4: __invoke

 public function __invoke(FormModel $model, $route)
 {
     $form = new ZendForm();
     foreach ($model->getElements() as $element) {
         $type = $element->getType();
         $name = $element->getName();
         $options = (array) Json::decode($element->getOptions());
         $form->addElement($type, $name, $options);
     }
     $form->addElement('hidden', IndexController::ID, array('value' => $model->getId()));
     $url = $this->getView()->url(array(), array('name' => $route . '/send'));
     $form->setView($this->getView())->setAction($url);
     return $form;
 }
开发者ID:bb-drummer,项目名称:Zcmf,代码行数:14,代码来源:Form.php

示例5: testMultiFileWithOneFile

 public function testMultiFileWithOneFile()
 {
     $form = new Form();
     $element = new FileElement('file');
     $element->setMultiFile(1);
     $subform0 = new SubForm();
     $subform0->addElement($element);
     $subform1 = new SubForm();
     $subform1->addSubform($subform0, 'subform0');
     $subform2 = new SubForm();
     $subform2->addSubform($subform1, 'subform1');
     $subform3 = new SubForm();
     $subform3->addSubform($subform2, 'subform2');
     $form->addSubform($subform3, 'subform3');
     $form->setView(new View());
     $output = (string) $form;
     $this->assertNotContains('name="file[]"', $output);
 }
开发者ID:alab1001101,项目名称:zf2,代码行数:18,代码来源:FileTest.php

示例6: testSubFormGetsUniqueIdWithName

 /**
  * @group ZF-2950
  */
 public function testSubFormGetsUniqueIdWithName()
 {
     $form = new Form();
     $form->setView($this->getView())->setName('testform')->addSubForm(new \Zend\Form\SubForm(), 'testform');
     $html = $form->render();
     $this->assertContains('<dt id="testform-label">&#160;</dt>', $html);
     $this->assertContains('<dd id="testform-element">', $html);
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:11,代码来源:FormTest.php


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