text() public method

public text ( string $name, string | null $value = null, array $attributes = [] ) : string
$name string The name of the text input
$value string | null The default value
$attributes array The attributes of the input
return string
 public function testPrependAppend()
 {
     $html = Form::prepend_append(Form::text('inputfoo'), '$', '.00');
     $matcher = array('tag' => 'input', 'attributes' => array('type' => 'text', 'name' => 'inputfoo', 'id' => 'inputfoo'), 'parent' => array('tag' => 'div', 'attributes' => array('class' => 'input-append'), 'child' => array('tag' => 'span', 'attributes' => array('class' => 'add-on'), 'content' => '$'), 'descendant' => array('tag' => 'span', 'attributes' => array('class' => 'add-on'), 'content' => '.00')));
     $this->assertTag($matcher, $html);
 }
Example #2
0
 /**
  * Create a text input field.
  *
  * @param string $name The name of the text input
  * @param string|null $value The default value
  * @param array $attributes The attributes of the input
  * @return string 
  * @param string $name
  * @param string $value
  * @param array $options
  * @return string 
  * @static 
  */
 public static function text($name, $value = null, $attributes = array())
 {
     return \Bootstrapper\Form::text($name, $value, $attributes);
 }
Example #3
0
    public function testCreateFullControlGroupWithOffsets()
    {
        $matcher = array(
            'tag' => 'div',
            'attributes' => array('class' => 'col-sm-2'),
            'child' => array(
                'tag' => 'label',
                'attributes' => array('for' => 'inputfoo'),
                'content' => 'foo',
            ),
            'parent' => array(
                'tag' => 'div',
                'attributes' => array('class' => 'form-group'),
                'child' => array(
                    'tag' => 'div',
                    'attributes' => array('class' => 'col-sm-10'),
                    'child' => array(
                        'tag' => 'input',
                        'attributes' => array(
                            'type' => 'text',
                            'name' => 'inputfoo',
                            'id' => 'inputfoo',
                            'class' => 'form-control'
                        ),
                    ),
                    'descendant' => array(
                        'tag' => 'span',
                        'attributes' => array(
                            'class' => 'help-block'
                        ),
                        'content' => 'You foobared that!',
                    ),
                ),
            ),
        );

        $html = Form::control_group(
            Form::label('inputfoo', 'foo'),
            Form::text('inputfoo'),
            null,
            Form::block_help('You foobared that!'),
            2
        );

        $this->assertHTML($matcher, $html);
    }