UI Import: PluginNotFoundException for file_validate_extensions on Drupal 11

Created on 5 September 2025, 15 days ago

Problem/Motivation

When using the patch #3426940: UI for import/export Default content to provide a UI, the option "Or you can upload content file with YAML structure" fails on Drupal 11.

Uploading a YAML file triggers a `PluginNotFoundException` because the validator `file_validate_extensions` no longer exists in Drupal 11.
Drupal 11 uses `FileExtension` instead of the legacy `file_validate_extensions`.

Error message:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_validate_extensions" plugin does not exist. Valid plugin IDs for Drupal\Core\Validation\ConstraintManager are: Callback, Blank, NotBlank, Email, Choice, Image, IdenticalTo, BlockContentEntityChanged, SourceEditingRedundantTags, CKEditor5ToolbarItem, CKEditor5EnabledConfigurablePlugins, CKEditor5ToolbarItemConditionsMet, SourceEditingPreventSelfXssConstraint, CKEditor5ToolbarItemDependencyConstraint, StyleSensibleElement, CKEditor5MediaAndFilterSettingsInSync, CKEditor5FundamentalCompatibility, UniqueLabelInList, CKEditor5Element, CommentName, ModerationState, DateTimeFormat, FileExtension, FileUriUnique, FileEncoding, FileExtensionSecure, FileIsImage, FileValidation, FileImageDimensions, FileNameLength, FileSizeLimit, LinkAccess, LinkType, LinkNotExistingInternal, LinkExternalProtocols, MediaMappingsConstraint, oembed_resource, MenuTreeHierarchy, MenuSettings, ParagraphsLibraryItemHasAllowedParagraphsType, PathAlias, TaxonomyHierarchy, RoleExists, UserNameUnique, UserMailUnique, ProtectedUserField, UserCancelMethod, UserMailRequired, UserName, ContentTranslationSynchronizedFields, NotNull, CountryCode, Length, AllowedValues, UniqueField, AtLeastOneOf, Count, ValidKeys, Regex, FullyValidatable, UriHost, EntityBundleExists, ComplexData, Null, PrimitiveType, Range, Uuid, ClassResolver, ValidPath, UniquePathAlias, LangcodeRequiredIfTranslatableValues, RequiredConfigDependencies, ConfigExists, PluginExists, MenuLinkDepth, EntityUntranslatableFields, ValidReference, Bundle, EntityHasField, EntityType, ReferenceAccess, ImmutableProperties, EntityChanged, ExtensionExists, ExtensionName in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Steps to reproduce

1. Install Default Content module.
2. Apply the UI patch UI for import / export Default content Active ( https://www.drupal.org/files/issues/2024-03-11/ui_default_content.patch ).
3. Go to `/admin/default-content/import`.
4. Try uploading a `.yml` file in the "Or you can upload content file with YAML structure" field.
5. Submit the form.

Proposed resolution

Replace the old validator key:

'#upload_validators' => [
  'file_validate_extensions' => ['yml'],
],

with the new Drupal 11 plugin ID:

'#upload_validators' => [
  'FileExtension' => ['yml'],
],

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇵🇪Peru edutrul

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024