Collective\Html\HtmlBuilder::attributeElement PHP Method

attributeElement() protected method

Build a single attribute element.
protected attributeElement ( string $key, string $value ) : string
$key string
$value string
return string
    protected function attributeElement($key, $value)
    {
        // For numeric keys we will assume that the key and the value are the same
        // as this will convert HTML attributes such as "required" to a correct
        // form like required="required" instead of using incorrect numerics.
        if (is_numeric($key)) {
            $key = $value;
        }
        if (!is_null($value)) {
            return $key . '="' . e($value) . '"';
        }
    }