Exemple #1
0
 public function testElementRendering()
 {
     $input = new Input();
     $input->setType('text');
     $input->setValue('value');
     $this->assertContains('<input type="text" value="value" ', $input->render());
 }
Exemple #2
0
 public function testValueWithSlashes()
 {
     $input = new Input();
     $input->setName('test');
     $input->setType('hidden');
     $value = ' 123"234 \' 44 ';
     $input->addFilter(new CallbackFilter('trim'));
     $input->setValue($value);
     $this->assertContains('<input type="hidden" name="test" value="123&quot;234 &#039; 44"', $input->render());
 }
Exemple #3
0
 /**
  * @return string
  */
 public function renderStart()
 {
     $hidden = new Element\Input();
     $hidden->setType('hidden');
     $hidden->addAttributes(['name' => $this->getUid()]);
     $hidden->setValue(1);
     # get default attribute
     $method = $this->getMethod();
     $this->setAttribute('method', $method);
     $html = '<form ' . Element\Html::renderAttributes($this->getAttributes()) . '>';
     $html .= $hidden->render();
     # render hidden element
     foreach ($this->getElements() as $element) {
         if ($element instanceof Element\Input and $element->getType() === 'hidden') {
             $html .= $element->render();
         }
     }
     return $html;
 }
Exemple #4
0
 /**
  * @return string
  */
 public function render()
 {
     return '<label>' . parent::render() . $this->label . '</label>';
 }