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).
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.
Replace the old validator key:
'#upload_validators' => [
'file_validate_extensions' => ['yml'],
],
with the new Drupal 11 plugin ID:
'#upload_validators' => [
'FileExtension' => ['yml'],
],
Active
2.0
Code