Source

<?php
    $bsform = new Barebone\Bootstrap\Form();
    $username = new Barebone\Bootstrap\FormGroup('Username2', 'username2', ['type' => 'text']);
    $username1 = new Barebone\Bootstrap\FormGroup('Username3', 'username3', ['type' => 'text']);
    // without creating extra variables, but this will be the first element in the form
    $bsform->addFormGroup( new Barebone\Bootstrap\FormGroup('Username1', 'username1', ['type' => 'text']) );
    //$username->getLabel()->innertext('Username');
    //$username->getInput()->name = 'Username';
    $password = new Barebone\Bootstrap\FormGroup('Password', 'password', ['type' => 'password']);
    
    $password->disable();
    $username->setSuccess();
    $username1->setWarning();
    $password->setError();
    //$password->enable();
    
    $bsform->addFormGroup($username);
    $bsform->addFormGroup($username1);
    //$bsform->addFormGroup($username2);
    $bsform->addFormGroup($password);
    
    $this->view->bsform = $bsform;

Result

<form role="form">
<div class="form-group">
<label class="control-label" for="username1">Username1</label>
<input type="text" name="username1" class="form-control" id="username1"></div>
<div class="form-group has-success has-feedback">
<label class="control-label" for="username2">Username2</label>
<input type="text" name="username2" class="form-control" id="username2"><span class="glyphicon glyphicon-ok form-control-feedback"></span>
</div>
<div class="form-group has-warning has-feedback">
<label class="control-label" for="username3">Username3</label>
<input type="text" name="username3" class="form-control" id="username3"><span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
</div>
<div class="form-group has-error has-feedback">
<label class="control-label" for="password">Password</label>
<input type="password" name="password" class="form-control" id="password" disabled="disabled"><span class="glyphicon glyphicon-remove form-control-feedback"></span>
</div>
</form>
  • Barebone\Bootstrap\FormGroup

    Barebone\Bootstrap\FormGroup extends Barebone\HTML\TElement
    • [P] $label : Barebone\HTML\TElement
    • [P] $input : Barebone\HTML\TElement
    • [P] $error : mixed
    • [M] __construct( $caption, $input_name, $input_attributes ) : void
    • [M] getLabel() : Barebone\HTML\TElement
    • [M] getInput() : Barebone\HTML\TElement
    • [M] setLabel( Barebone\HTML\TElement $label ) : void
    • [M] setInput( Barebone\HTML\TElement $input ) : void
    • [M] enable() : void
    • [M] disable() : void
    • [M] setError() : void
    • [M] setWarning() : void
    • [M] setSuccess() : void
    • Barebone\HTML\TElement

      Barebone\HTML\TElement
      • [P] $tag : string
      • [P] $innertext : string
      • [P] $children : array
      • [P] $attributes : array
      • [P] $non_closing_tags : mixed
      • [M] __construct( string $tag, array $attributes ) : void
      • [M] append( Barebone\HTML\TElement $element ) : void
      • [M] prepend( Barebone\HTML\TElement $element ) : void
      • [M] class_exists( $cssclass ) : void
      • [M] add_class( $cssclass ) : void
      • [M] remove_class( $cssclass ) : void
      • [M] innertext( string $value ) : void
      • [M] data( string $name, string $value ) : void
      • [M] aria( string $name, string $value ) : void
      • [M] on( string $event, string $callback ) : void
      • [M] css( string $identifier, string $rule ) : void
      • [M] wrap( string $tagname, array $attributes ) : void
      • [M] enable() : void
      • [M] disable() : void
      • [M] has_closing_tag() : void
      • [M] has_children() : void
      • [M] count_children() : void
      • [M] get_children() : void
      • [M] replace_child( $key, $new_child ) : void
      • [M] get_child( $key ) : void
      • [M] __unset( $name ) : void
      • [M] __isset( $name ) : void
      • [M] __set( $name, $value ) : void
      • [M] __get( $name ) : void
      • [M] render() : void
      • [M] __toString() : string
      • [M] editable() : void