🇧🇪Belgium @barry75

Account created on 1 March 2014, about 11 years ago
#

Recent comments

🇧🇪Belgium barry75

I traced the issue to function ImageWidget::process() in the file /modules/contrib/plupload_widget/src/Plugin/Field/FieldWidget/ImageWidget.php :

// Replace the upload HTML element with PLUPLOAD
    // for a single file.
    $element['upload'] = [
      '#type' => 'plupload',
      '#title' => t('Upload files'),
      // '#description' => t('This multi-upload widget uses Plupload library.'),
      '#autoupload' => TRUE,
      '#autosubmit' => TRUE,
      '#submit_element' => "[name={$element['upload_button']['#name']}]",
      '#upload_validators' => $configuration->validators,
      '#plupload_settings' => [
     ...

This code places NEW $element['upload']['#upload_validators'], that apparently gets priority over the already existing $element['#upload_validators'].

A quick solution: at the end of the function, add this line:

	// replace the upload validators with the original upload validators
	$element['upload']['#upload_validators'] = $element['#upload_validators'];

	return $element;

Please review...
This could be done more elegant, but I'm not sure about the function of the $configuration->validators variable ?

Production build 0.71.5 2024