trait PluploadWidgetTrait in PlUPload File Widget 8
Hierarchy
- trait \Drupal\plupload_widget\Plugin\Field\FieldWidget\PluploadWidgetTrait
2 files declare their use of PluploadWidgetTrait
- FileWidget.php in src/
Plugin/ Field/ FieldWidget/ FileWidget.php - ImageWidget.php in src/
Plugin/ Field/ FieldWidget/ ImageWidget.php
File
- src/
Plugin/ Field/ FieldWidget/ PluploadWidgetTrait.php, line 20
Namespace
Drupal\plupload_widget\Plugin\Field\FieldWidgetView source
trait PluploadWidgetTrait {
/**
* Get the optimum chunk size.
*/
public function getChunkSize() {
// 500 Kb per chunk does not sound bad...
$good_size = 1024 * 500;
// This is what the PLUPLOAD module
// field element takes as the default
// chunk size.
$size = Bytes::toInt(ini_get('post_max_size'));
if ($size > $good_size) {
$size = $good_size;
}
return $size;
}
/**
* Returns the maximum configured
* file size for the Field stroage
* in Bytes.
*
* @return double|int
*/
public function getMaxFileSize() {
// We don't care about PHP's max post
// or upload file size because we use
// plupload.
$size = $this
->getFieldSetting('max_filesize');
$size = Bytes::toInt($size);
return $size;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluploadWidgetTrait:: |
public | function | Get the optimum chunk size. | |
PluploadWidgetTrait:: |
public | function | Returns the maximum configured file size for the Field stroage in Bytes. |