labelCols = $labelCols;
        $this->fieldCols = $fieldCols;
    }
    public function help($text)
    {
        return view('form._help-inner', ['help' => $text]);
    }
    public function header($hx, $text)
    {
        return  "
".
                    "fieldCols offset-md-$this->labelCols\">".e($text)."".
                "
";
    }
    public function par($text, $extraClasses='', $escape=true)
    {
        return
            "".
                "
fieldCols offset-md-$this->labelCols mb-2 ".e($extraClasses)."\">".
                    ($escape ? e($text) : $text) .
                "
".
            "
 ";
    }
    /**
     * Convert the given string to a-href if it is a link.
     *
     * @param $href
     * @return string
     */
    public function tryLink($href)
    {
        $href = trim($href);
        if (starts_with($href, ['http://', 'https://', 'mailto:', 'ftp://'])) {
            $href_e = e($href);
            return "".$href_e."";
        } else {
            return $href;
        }
    }
    public function collapsible($text, $thrSize, $maxHeight)
    {
        return new CollapsibleTextBoxWidget($text, $thrSize, $maxHeight);
    }
    private function baseWidget($view, $name, $label)
    {
        return (new Widget($view, $name, $label))->layout($this->labelCols, $this->fieldCols);
    }
    public function text($name, $label)
    {
        return $this->baseWidget('input', $name, $label);
    }
    public function password($name, $label)
    {
        return $this->baseWidget('input', $name, $label)->type('password');
    }
    public function number($name, $label)
    {
        return $this->baseWidget('input', $name, $label)->type('number');
    }
    public function email($name, $label)
    {
        return $this->baseWidget('input', $name, $label)->type('email');
    }
    public function checkbox($name, $label)
    {
        return (new CheckboxWidget('checkbox', $name, $label))
            ->layout($this->labelCols, $this->fieldCols);
    }
    public function textarea($name, $label)
    {
        return $this->baseWidget('textarea', $name, $label)->minHeight('4em');
    }
}