Problem/Motivation

When adding an icon to the paragraph, the folowing error occurs and blocks the upload:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_validate_extensions" plugin does not exist. Valid plugin IDs for Drupal\Core\Validation\ConstraintManager are: ...

Steps to reproduce

Install a module on the core 11.1, create a paragraph type and try to upload an image to the Paragraph icon field

Proposed resolution

The function is deprecated in Drupal 11: https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/fu...
Need to use the 'file.validator' service instead https://www.drupal.org/node/3363700

Patch that fixes the deprecation error is attached.

CommentFileSizeAuthor
deprecated-file-validate.patch638 bytesyevko
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

yevko created an issue. See original summary.

yevko’s picture

Issue summary: View changes

trishen made their first commit to this issue’s fork.

trishen’s picture

Status: Active » Reviewed & tested by the community

I checked patch and created an MR with standards support.

gueguerreiro made their first commit to this issue’s fork.

gueguerreiro’s picture

Updated the MR to fix the file validation to the correct format. As per https://www.drupal.org/node/3363700, we need an "extensions" as the array key.

So we need to change from:

    $validators = ['FileExtension' => ['png gif jpg jpeg apng svg']];

to:

    $validators = ['FileExtension' => ['extensions' => 'png gif jpg jpeg apng svg']];

The previous change fixes the error, but wasn't actually validating anything anymore.

borisson_’s picture

Since the previous function was removed in drupal 11 we need to fix this, rtbc++

damienmckenna’s picture

Version: 8.x-1.3 » 8.x-1.x-dev

The patch is no longer appropriate, the MR is the correct approach.