'#weight' => 1,
'#maxlength' => 256,
// By making this field required, we prevent a potential security issue
// that would allow files of any type to be uploaded.
'#required' => TRUE,
];
$element['max_filesize'
] =
[ '#type' => 'textfield',
'#title' =>
$this->
t('Maximum upload size'
),
'#default_value' =>
$settings['max_filesize'
],
'#description' =>
$this->
t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes could be limited only by PHP\'s maximum post and file upload sizes (current limit <strong>%limit</strong>).',
['%limit' =>
format_size(Environment::
getUploadMaxSize())]),
'#size' => 10,
'#element_validate' =>
[[static::
class, 'validateMaxFilesize'
]],
'#weight' => 5,
];
$element['description_field'
] =
[ '#type' => 'checkbox',
'#title' =>
$this->
t('Enable <em>Description</em> field'
),
'#default_value' =>
$settings['description_field'
] ?? '',
'#description' =>
$this->
t('The description field allows users to enter a description about the uploaded file.'
),
'#weight' => 11,
];