TbHtml::textArea PHP Method

textArea() public static method

Generates a text area input.
public static textArea ( string $name, string $value = '', array $htmlOptions = [] ) : string
$name string the input name.
$value string the input value.
$htmlOptions array additional HTML attributes.
return string the generated text area.
    public static function textArea($name, $value = '', $htmlOptions = array())
    {
        // In case we do need to create a div container for the text area
        $containerOptions = array();
        // Get the intended input width before the rest of the options are normalized
        self::addSpanClass($htmlOptions);
        self::addColClass($htmlOptions);
        $col = self::popColClasses($htmlOptions);
        $htmlOptions = self::normalizeInputOptions($htmlOptions);
        self::addCssClass('form-control', $htmlOptions);
        $output = '';
        if (!empty($col)) {
            self::addCssClass($col, $containerOptions);
            $output .= self::openTag('div', $containerOptions);
        }
        $output .= parent::textArea($name, $value, $htmlOptions);
        if (!empty($col)) {
            $output .= '</div>';
        }
        return $output;
    }

Usage Example

Exemplo n.º 1
0
 public function testTextArea()
 {
     $I = $this->codeGuy;
     $html = TbHtml::textArea('textarea', 'Textarea text', array('class' => 'textarea'));
     $textarea = $I->createNode($html, 'textarea');
     $I->seeNodeAttributes($textarea, array('class' => 'textarea', 'id' => 'textarea', 'name' => 'textarea'));
     $I->seeNodeText($textarea, 'Textarea text');
 }
All Usage Examples Of TbHtml::textArea
TbHtml