["?string", ".pdf,image/*", "types MIME acceptés"], "btn_class" => ["?string", "btn-default", "Classe du bouton"], "btn_style" => ["?string", null, "Style du bouton"], "btn_label" => ["content", "Sélectionner un fichier", "Texte du bouton"], ]; function __construct(Form $form, ?array $params=null) { parent::__construct($form, $params); $this->ppPlaceholder = null; } function pp_setAccept(?string $accept) { $this->ppAttrs["accept"] = $accept; } /** @var ?string */ protected $ppBtnClass; /** @var string|array */ protected $ppBtnLabel; function buildControl(): array { $name = $this->ppName; $value = $this->ppValue; return v::tag("label", [ "class" => ["btn btn-file", $this->ppBtnClass], v::tag1("input", [ "type" => static::INPUT_TYPE, "id" => $this->ppId, "name" => $name, "value" => $value, "readonly" => $this->ppReadonly? "readonly": false, "disabled" => $this->ppDisabled? "disabled": false, "required" => $this->ppRequired? "required": false, "style" => "display: inline; visibility: hidden; width: 0px; height: 0px; vertical-align: middle;", $this->ppAttrs, ]), v::span([ "class" => ["file-label", $this->ppClass], "style" => $this->ppStyle, $this->ppBtnLabel, ]), ]); } }