Gregwar\Formidable\Fields\Field::getHtml PHP Method

getHtml() public method

public getHtml ( )
    public function getHtml()
    {
        $html = '<input ';
        foreach ($this->attributes as $name => $value) {
            $html .= $name . '="' . $value . '" ';
        }
        if ($this->required) {
            $html .= 'required="required" ';
        }
        $html .= 'type="' . $this->type . '" ';
        $html .= 'name="' . $this->getName() . '" ';
        if (($value = $this->getValue()) !== null && gettype($value) != 'object') {
            $html .= 'value="' . htmlspecialchars($value) . '" ';
        }
        $html .= '/>';
        return $html;
    }

Usage Example

コード例 #1
0
ファイル: CaptchaField.php プロジェクト: rgv151/Formidable
 public function getHtml()
 {
     $temp = $this->value;
     $this->value = '';
     $input_html = parent::getHtml();
     $this->value = $temp;
     $_SESSION['Formidable_Captcha'] = $this->getCaptchaValue();
     $html = '<img src="' . $this->builder->inline() . '" class="Formidable_Captcha" alt="Code visuel" ><br />' . $input_html;
     return $html;
 }