本文整理汇总了PHP中Zend_Form::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::render方法的具体用法?PHP Zend_Form::render怎么用?PHP Zend_Form::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Setup decorators and properties and return render output
*
* @return string
*/
public function render()
{
$this->addElements();
$this->setupElementsCommon();
$this->setupElementsUnique();
$this->setupForm();
return $this->form->render();
}
示例2: render
/**
* Render
* @param Zend_View_Interface $view
* @return Zend_View
*/
public function render(Zend_View_Interface $view = null)
{
if (!empty($this->_type)) {
$this->setAttrib('class', trim('form-' . $this->_type . ' ' . $this->getAttrib('class')));
}
return parent::render($view);
}
示例3: render
/**
* Render form
*
* @param Zend_View_Interface $view
* @return string
*/
public function render(Zend_View_Interface $view = null)
{
if (null === $view && $this->_view === null) {
$view = new Zend_View();
}
return parent::render($view);
}
示例4: render
public function render()
{
$requiredSuffx = '<span title="This field is required." class="form-required">*</span>';
foreach ($this->getElements() as $element) {
$decorator = $element->getDecorator('Label');
if ($decorator) {
if ($element->getLabel()) {
// need to check this, since label decorator can be blank
$element->setLabel($element->getLabel() . " ");
}
$decorator->setOption('requiredSuffix', $requiredSuffx);
$decorator->setOption('escape', false);
}
if ($element->getErrors()) {
$this->addElementClass($element, 'error');
}
// Add a wrapper div to all elements other than add and remove buttons.
if ($element->getName() != 'add' && $element->getName() != 'remove') {
if ($element->getName() == 'id' || $element->getType() == 'Zend_Form_Element_Hidden' && preg_match('/_id/', $element->getName())) {
$element->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-item ele-id clearfix'))));
} else {
if ($element->getName() == 'save_and_view' || $element->getName() == 'save') {
$element->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-item ele-submit-buttons clearfix'))));
} else {
$element->addDecorators(array(array(array('wrapperAll' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-item clearfix'))));
}
}
} else {
$element->removeDecorator('label');
}
}
$output = parent::render();
return $output;
}
示例5: render
public function render(Zend_View_Interface $view = null)
{
$decorators = array(array('ViewHelper'), array('Label'));
$elements = $this->getElements();
$elements_name = array();
foreach ($elements as $element) {
$type = explode('_', $element->getType());
$type = strtolower(array_pop($type));
$element->setAttrib('class', $type);
if ($type == 'hidden' || $type == 'submit' || $type == 'button' || $type == 'reset') {
$element->setDecorators($decorators[0]);
} else {
if ($type == 'file') {
$element->setDecorators(array('File', $decorators[1]));
} else {
$element->setDecorators($decorators);
}
}
array_push($elements_name, $element->getName());
}
if (count($elements_name) > 0) {
$this->addDisplayGroup($elements_name, $this->getName(), array('legend' => $this->getLegend()));
$this->setDisplayGroupDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'div-' . $this->getName()))));
}
return parent::render($view);
}
示例6: testEmptyFormNameShouldNotRenderEmptyFormId
public function testEmptyFormNameShouldNotRenderEmptyFormId()
{
$form = new Zend_Form();
$form->setMethod('post')->setAction('/foo/bar')->setView($this->getView());
$html = $form->render();
$this->assertNotContains('id=""', $html, $html);
}
示例7: testEnctypeDefaultsToMultipartWhenFileElementIsAttachedToDisplayGroup
/**
* @group ZF-5370
*/
public function testEnctypeDefaultsToMultipartWhenFileElementIsAttachedToDisplayGroup()
{
$this->form->addElement('file', 'txt')->addDisplayGroup(array('txt'), 'txtdisplay')->setView(new Zend_View());
$html = $this->form->render();
$this->assertContains('id="txt"', $html);
$this->assertContains('name="txt"', $html);
$this->assertRegexp('#<form[^>]+enctype="multipart/form-data"#', $html, $html);
}
示例8: testRenderedSubFormDtShouldContainNoBreakSpace
/**
* @see ZF-3272
*/
public function testRenderedSubFormDtShouldContainNoBreakSpace()
{
$subForm = new Zend_Form_SubForm(array('elements' => array('foo' => 'text', 'bar' => 'text')));
$form = new Zend_Form();
$form->addSubForm($subForm, 'foobar')->setView(new Zend_View());
$html = $form->render();
$this->assertContains('<dt> </dt>', $html);
}
示例9: testDisplayGroupsShouldInheritSubFormNamespace
/**
* @see ZF-2883
*/
public function testDisplayGroupsShouldInheritSubFormNamespace()
{
$this->form->addElement('text', 'foo')->addElement('text', 'bar')->addDisplayGroup(array('foo', 'bar'), 'foobar');
$form = new Zend_Form();
$form->addSubForm($this->form, 'attributes');
$html = $form->render(new Zend_View());
$this->assertContains('name="attributes[foo]"', $html);
$this->assertContains('name="attributes[bar]"', $html);
}
示例10: render
/**
* Overriding zend form render.
*/
public function render()
{
$requiredSuffx = '<span title="This field is required." class="form-required">*</span>';
foreach ($this->getElements() as $element) {
$element = $this->decorateElement($element);
}
$output = parent::render();
return $output;
}
示例11: testLabelIdIsCorrect
public function testLabelIdIsCorrect()
{
$form = new \Zend_Form();
$form->setElementsBelongTo('comment');
$this->element->setLabel("My Captcha");
$form->addElement($this->element);
$html = $form->render($this->getView());
$expect = sprintf('for="comment-%s-input"', $this->element->getName());
$this->assertRegexp("/<label [^>]*?{$expect}/", $html, $html);
}
示例12: render
/**
* Wrap parent to provide a default Zend_View if none
* is given
*
* @param Zend_View_Interface $view
* @return string
*/
public function render(Zend_View_Interface $view = NULL)
{
if (NULL === $view) {
if (NULL == $this->getView()) {
$this->setView(new Zend_View());
}
$view = $this->getView();
}
return parent::render($view);
}
示例13: testRenderElement
public function testRenderElement()
{
$form = new Zend_Form();
$form->addElement($this->element);
$view = new Zend_View();
$view->addHelperPath('Application/View/Helper', 'Application_View_Helper');
$form->setAction('/foo.php?bar')->setView($view);
$html = $form->render();
$this->assertContains('<input type="date" name="foo" id="foo" value="" disabled="1">', $html);
}
示例14: render
/**
* Set default render
*/
public function render($content = null)
{
$this->setAttrib('class', $this->getAttrib('class') . ' formLayout');
$defaultDecorators = array('FormElements', 'Form');
$defaultGroupDecorators = array('FormElements', 'Fieldset');
$this->setElementDecorators(array('Composite'));
$this->setDisplayGroupDecorators($defaultGroupDecorators);
$this->setSubFormDecorators($defaultDecorators);
$this->setDecorators($defaultDecorators);
return parent::render($content);
}
示例15: render
public function render(Zend_View_Interface $view = null)
{
jQuery::evalScript('
$(".z-form fieldset legend").click(function(){
$(this).parent().find(">dl").toggle("blind",200);
})
');
if (!$this->getAttrib('id')) {
$this->setAttrib('id', 'z-admin-form-' . rand(1000000, 10000000));
}
return parent::render($view);
}