本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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"> </dt>', $html);
$this->assertContains('<dd id="testform-element">', $html);
}