Esempio n. 1
0
 public function row(AbstractRow $row, $use_label = true)
 {
     $html = $row->input($this);
     if ($use_label) {
         $html = Html::label($row->getName(), $row->getLabel()) . $html;
     }
     if ($error = $row->getError($this)) {
         $html .= sprintf('<p>%s</p>', $error);
     }
     return Html::tag('div', $html);
 }
Esempio n. 2
0
 public function row(AbstractRow $row, $use_label = true)
 {
     $html = $row->input($this);
     if ($use_label) {
         $html = Html::label($row->getName(), $row->getLabel()) . $html;
     }
     $error = $row->getError($this);
     if ($error) {
         $html .= sprintf('<p class="help-block">%s</p>', $error);
         return Html::tag('div', $html, array('class' => 'form-group has-error'));
     }
     return Html::tag('div', $html, array('class' => 'form-group'));
 }
Esempio n. 3
0
 public function row(AbstractRow $row, $use_label = true)
 {
     $html = $row->input($this);
     $error = $row->getError($this);
     if ($use_label) {
         $attr = $error ? array('class' => 'error') : array();
         $html = Html::label($row->getName(), $row->getLabel() . $html, $attr);
     }
     if ($error) {
         $html .= sprintf('<small class="error">%s</small>', $error);
     }
     return Html::tag('div', $html);
 }
Esempio n. 4
0
 public function testTag()
 {
     $this->assertSame('<p></p>', Html::tag('p'));
     $this->assertSame('<p>Hello world</p>', Html::tag('p', 'Hello world'));
     $this->assertSame('<p class="text" id="something">Hello world</p>', Html::tag('p', 'Hello world', array('class' => 'text', 'id' => 'something')));
 }
Esempio n. 5
0
 public function testCreateEmptyForm()
 {
     $f = $this->createForm('/post/url');
     $expected = Html::tag('form', null, array('action' => '/post/url', 'method' => 'POST'));
     $this->assertSame($expected, $f->render());
 }