18 declare(strict_types=1);
64 $this->data_factory = $data_factory;
66 $this->upload_handler = $handler;
86 $size_in_bytes = $this->upload_limit_resolver->min($size_in_bytes);
89 $clone->max_file_size = $size_in_bytes;
96 return $this->max_file_size ?? $this->upload_limit_resolver->getUploadLimit();
101 $clone = clone $this;
114 $clone = clone $this;
115 $clone->accepted_mime_types = $mime_types;
139 $this->checkArg(
"value", $this->
isClientSideValueOk($value),
"Display value does not match input type.");
141 $clone = clone $this;
142 $identifier_key = $clone->upload_handler->getFileIdentifierParameterName();
143 foreach ($value as
$data) {
144 $file_id = ($clone->hasMetadataInputs()) ? $data[$identifier_key] : $data;
148 $clone->dynamic_inputs[$file_id] = $clone->dynamic_input_template->withValue($data);
169 'invalid_mime' => $this->
language->txt(
'ui_file_input_invalid_mime'),
170 'invalid_size' => $this->
language->txt(
'ui_file_input_invalid_size'),
171 'invalid_amount' => $this->
language->txt(
'ui_file_input_invalid_amount'),
172 'general_error' => $this->
language->txt(
'ui_file_input_general_error'),
178 return static function () {
184 if ($this->requirement_constraint !== null) {
185 return $this->requirement_constraint;
188 return $this->
refinery->custom()->constraint(
190 return (is_array($value) && count($value) > 0);
192 function (
$txt, $value) {
193 return $txt(
"msg_no_files_selected");
200 if (!is_array($value)) {
204 foreach ($value as
$data) {
214 if (!array_key_exists($this->upload_handler->getFileIdentifierParameterName(),
$data)) {
220 if (!$this->dynamic_input_template->isClientSideValueOk($data)) {
231 $default_metadata_input =
new Hidden(
236 if (null === $metadata_input) {
237 return $default_metadata_input;
241 $metadata_input->getInputs() : [
246 $inputs[$this->upload_handler->getFileIdentifierParameterName()] = $default_metadata_input;
249 $this->has_metadata_inputs =
true;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A constraint encodes some resrtictions on values.
__construct(Container $dic, ilPlugin $plugin)
Refinery Factory $refinery