Encore\Admin\Widgets\Form::formatAttribute PHP Method

formatAttribute() public method

Format form attributes form array to html.
public formatAttribute ( array $attributes = [] ) : string
$attributes array
return string
    public function formatAttribute($attributes = [])
    {
        $attributes = $attributes ?: $this->attributes;
        if ($this->hasFile()) {
            $attributes['enctype'] = 'multipart/form-data';
        }
        $html = [];
        foreach ($attributes as $key => $val) {
            $html[] = "{$key}=\"{$val}\"";
        }
        return implode(' ', $html) ?: '';
    }