18 declare(strict_types=1);
65 $this->data_factory = $data_factory;
88 $clone->max_file_size_in_bytes = $clone->upload_limit_resolver->getBestPossibleUploadLimitInBytes(
89 $clone->upload_handler,
103 $clone = clone $this;
116 $clone = clone $this;
117 $clone->accepted_mime_types = $mime_types;
141 $this->checkArg(
"value", $this->
isClientSideValueOk($value),
"Display value does not match input type.");
143 $clone = clone $this;
144 $identifier_key = $clone->upload_handler->getFileIdentifierParameterName();
145 foreach ($value as
$data) {
146 $file_id = ($clone->hasMetadataInputs()) ? $data[$identifier_key] : $data;
150 $clone->dynamic_inputs[$file_id] = $clone->dynamic_input_template->withValue($data);
171 'invalid_mime' => $this->
language->txt(
'ui_file_input_invalid_mime'),
172 'invalid_size' => $this->
language->txt(
'ui_file_input_invalid_size'),
173 'invalid_amount' => $this->
language->txt(
'ui_file_input_invalid_amount'),
174 'general_error' => $this->
language->txt(
'ui_file_input_general_error'),
180 return static function () {
186 if ($this->requirement_constraint !== null) {
187 return $this->requirement_constraint;
190 return $this->
refinery->custom()->constraint(
192 return (is_array($value) && count($value) > 0);
194 function (
$txt, $value) {
195 return $txt(
"msg_no_files_selected");
202 if (!is_array($value)) {
206 foreach ($value as
$data) {
216 if (!array_key_exists($this->upload_handler->getFileIdentifierParameterName(),
$data)) {
222 if (!$this->dynamic_input_template->isClientSideValueOk($data)) {
233 $default_metadata_input =
new Hidden(
238 if (null === $metadata_input) {
239 return $default_metadata_input;
243 $metadata_input->getInputs() : [
248 $inputs[$this->upload_handler->getFileIdentifierParameterName()] = $default_metadata_input;
251 $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.
Refinery Factory $refinery