public static function VideoUploadTranscodeWidget::validateMaxFilesize in Video 8.2
Form API callback.
Ensures that a size has been entered and that it can be parsed by \Drupal\Component\Utility\Bytes::toInt().
This function is assigned as an #element_validate callback in settingsForm().
Overrides VideoUploadWidget::validateMaxFilesize
File
- modules/
video_transcode/ src/ Plugin/ Field/ FieldWidget/ VideoUploadTranscodeWidget.php, line 30
Class
- VideoUploadTranscodeWidget
- Plugin implementation of the 'video_upload_transcode' widget.
Namespace
Drupal\video_transcode\Plugin\Field\FieldWidgetCode
public static function validateMaxFilesize($element, FormStateInterface $form_state) {
if (!empty($element['#value']) && Bytes::toInt($element['#value']) == 0) {
$form_state
->setError($element, t('The option must contain a valid value. You may either leave the text field empty or enter a string like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes).'));
}
}