protected function WebformManagedFileBase::getMaxFileSize in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformManagedFileBase.php \Drupal\webform\Plugin\WebformElement\WebformManagedFileBase::getMaxFileSize()
Get max file size for an element.
Parameters
array $element: An element.
Return value
int Max file size.
1 call to WebformManagedFileBase::getMaxFileSize()
- WebformManagedFileBase::prepare in src/
Plugin/ WebformElement/ WebformManagedFileBase.php - Prepare an element to be rendered within a webform.
File
- src/
Plugin/ WebformElement/ WebformManagedFileBase.php, line 595
Class
- WebformManagedFileBase
- Provides a base class webform 'managed_file' elements.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function getMaxFileSize(array $element) {
$max_filesize = $this->configFactory
->get('webform.settings')
->get('file.default_max_filesize') ?: Environment::getUploadMaxSize();
$max_filesize = Bytes::toInt($max_filesize);
if (!empty($element['#max_filesize'])) {
$max_filesize = min($max_filesize, Bytes::toInt($element['#max_filesize'] . 'MB'));
}
return $max_filesize;
}