Problem/Motivation
While testing other bugs on a vanilla D10.4.1 site, I had an issue with 8.x-1.0-alpha4 whereby I attempted to add a Media Remote Image item and it would not allow me to. I got this error, followed by lots of error code that is shown below.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "RemoteImageUrl" plugin does not exist. ...
Steps to reproduce
- Install D10 site.
- Install 8.x-1.0-alpha4.
- Add a Media Remote Image item and save it.
Proposed resolution
I fixed it by changing @constraint
(lower case "c") to @Constraint
(upper case "C") in src/Plugin/Validation/Constraint/RemoteImageUrlConstraint.php
.
Unfortunately the problem is inconsistent. It sometimes doesn't affect me, and probably won't affect some, but that lower case "c" is incorrect and should be changed anyway. It may underlie some other issues.
Related error log:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "RemoteImageUrl" plugin does not exist. Valid plugin IDs for Drupal\Core\Validation\ConstraintManager are: Callback, Blank, NotBlank, Email, Choice, Image, BlockContentEntityChanged, CKEditor5ToolbarItemDependencyConstraint, SourceEditingPreventSelfXssConstraint, CKEditor5ToolbarItem, UniqueLabelInList, CKEditor5MediaAndFilterSettingsInSync, CKEditor5EnabledConfigurablePlugins, CKEditor5ToolbarItemConditionsMet, CKEditor5FundamentalCompatibility, StyleSensibleElement, SourceEditingRedundantTags, CKEditor5Element, CommentName, DateTimeFormat, FileValidation, FileUriUnique, FileImageDimensions, FileIsImage, FileExtension, FileExtensionSecure, FileSizeLimit, FileNameLength, LinkType, LinkExternalProtocols, LinkNotExistingInternal, LinkAccess, oembed_resource, MediaMappingsConstraint, MenuTreeHierarchy, MenuSettings, PathAlias, TaxonomyHierarchy, ProtectedUserField, UserNameUnique, UserName, UserMailRequired, UserMailUnique, ConfigExists, LangcodeRequiredIfTranslatableValues, RequiredConfigDependencies, ValidPath, UniquePathAlias, NotNull, Length, PrimitiveType, Regex, CountryCode, EntityBundleExists, FullyValidatable, ComplexData, AllowedValues, Range, UniqueField, ValidKeys, Null, Count, Uuid, ExtensionExists, ExtensionName, PluginExists, EntityUntranslatableFields, EntityHasField, ImmutableProperties, ValidReference, EntityType, EntityChanged, Bundle, ReferenceAccess in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition() (Line: 21)
Drupal\Core\Validation\ConstraintFactory->createInstance() (Line: 83)
Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 86)
Drupal\Core\Validation\ConstraintManager->create() (Line: 123)
Drupal\Core\TypedData\TypedData->getConstraints() (Line: 262)
Drupal\Core\Field\FieldItemList->getConstraints() (Line: 45)
Drupal\Core\TypedData\Validation\TypedDataMetadata->getConstraints() (Line: 38)
Drupal\Core\TypedData\Validation\TypedDataMetadata->findConstraints() (Line: 152)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 106)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate() (Line: 93)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate() (Line: 132)
Drupal\Core\TypedData\TypedData->validate() (Line: 518)
Drupal\Core\Entity\ContentEntityBase->validate() (Line: 472)
Drupal\media\Entity\Media->validate() (Line: 188)
Drupal\Core\Entity\ContentEntityForm->validateForm()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 274)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 593)
Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)