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); }
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')); }
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); }
public function testLabelOverrideAttributes() { $expected = '<label for="username1">Username</label>'; $this->assertSame($expected, Html::label('username', 'Username', array('for' => 'username1'))); }