Gregwar\Formidable\Fields\Select::getHtml PHP Метод

getHtml() публичный Метод

public getHtml ( )
    public function getHtml()
    {
        $arr = '';
        if ($this->multiple) {
            $arr = '[]';
        }
        $html = '<select name="' . $this->getName() . $arr . '" ';
        foreach ($this->attributes as $name => $value) {
            $html .= $name . '="' . $value . '" ';
        }
        $html .= ">\n";
        if (!$this->required) {
            $html .= '<option value=""></option>';
        }
        foreach ($this->options as $option) {
            if ($this->multiple && is_array($this->value) && in_array($option->getValue(), $this->value) || !$this->multiple && $option->getValue() == $this->value) {
                $html .= $option->getOptionHtml(true);
            } else {
                $html .= $option->getOptionHtml(false);
            }
        }
        $html .= "</select>\n";
        return $html;
    }