Example #1
0
 public function testCanRenderWithHelpBlock()
 {
     $label = $this->builder->label('Email');
     $text = $this->builder->text('email');
     $formGroup = new FormGroup($label, $text);
     $formGroup->helpBlock('Email is required.');
     $expected = '<div class="form-group"><label>Email</label><input type="text" name="email"><p class="help-block">Email is required.</p></div>';
     $result = $formGroup->render();
     $this->assertEquals($expected, $result);
 }
 public function file($label, $name, $value = null)
 {
     $control = $this->builder->file($name)->value($value);
     $label = $this->builder->label($label, $name)->addClass('control-label')->forId($name);
     $control->id($name);
     $formGroup = new FormGroup($label, $control);
     if ($this->builder->hasError($name)) {
         $formGroup->helpBlock(new HelpBlock($this->builder->getError($name)));
         $formGroup->addClass('has-error');
     }
     return $this->wrap($formGroup);
 }
 public function __construct(Label $label, Element $control, $controlSizes)
 {
     parent::__construct($label, $control);
     $this->controlSizes = $controlSizes;
 }
 public function __construct(Label $label, Element $control, $controlWidth = 10)
 {
     parent::__construct($label, $control);
     $this->controlWidth = $controlWidth;
 }