The "" plugin does not exist on config save in PolicyEditForm.php

Created on 1 November 2023, 8 months ago
Updated 7 March 2024, 4 months ago

Problem/Motivation

Drupal\Component\Plugin\Exception\PluginNotFoundException thrown in Drupal\ Core \Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php when saving configuration in PolicyEditForm

The full error:

An unexpected error has occurred. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException : The "" plugin does not exist. Valid plugin IDs for Drupal\symfony_mailer\Processor\EmailAdjusterManager are: email_plain, email_cc, email_priority, mailer_url_to_absolute, mailer_wrap_and_convert, email_to, email_subject, mailer_default_headers, email_bcc, mailer_hooks, email_body, email_from, email_theme, email_transport, mailer_inline_css, email_skip_sending, email_reply_to in Drupal\ Core \Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php ).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('', Array) (Line: 83)
Drupal\Component\Plugin\PluginManagerBase->createInstance('', Array) (Line: 17)
Drupal\symfony_mailer\Processor\AdjusterPluginCollection->initializePlugin('') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('') (Line: 160)
Drupal\Core\Plugin\DefaultLazyPluginCollection->setInstanceConfiguration('', Array) (Line: 135)
Drupal\Core\Plugin\DefaultLazyPluginCollection->setConfiguration(Array) (Line: 26)
Drupal\symfony_mailer\Form\PolicyEditForm->form(Array, Object) (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('mailer_policy_edit_form', Object) (Line: 375)
Drupal\Core\Form\FormBuilder->rebuildForm('mailer_policy_edit_form', Object, Array) (Line: 633)
Drupal\Core\Form\FormBuilder->processForm('mailer_policy_edit_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 44)
Drupal\redirect_after_login\RedirectMiddleware->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  1. Go to /admin/config/system/mailer and add a new Policy, After selecting Type and adding Sub-Type it will redirect to Policy edit form.
  2. Select any element and press "Add Element".
  3. Add element details and press Save on the form.

Please see the video

https://drive.google.com/file/d/1qHwrg8Kub8tGWLzb_3y2DPXHBBv9b_-6/view?usp=sharing.

Proposed resolution

I guess that the #empty_value is causing that error since it is producing empty value for configs (but I am not sure, needs to be verified).

$form['add_actions']['add_select'] = [
  '#type' => 'select',
  '#options' => $options,
  '#empty_value' => '',
  '#empty_option' => $this->t('- Select element to add -'),
];
πŸ› Bug report
Status

Postponed: needs info

Version

1.4

Component

Code

Created by

πŸ‡¦πŸ‡²Armenia Alen Simonyan

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

Comments & Activities

  • Issue created by @Alen Simonyan
  • Status changed to Postponed: needs info 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom AdamPS

    It works for me and no one else has reported. Maybe it is related to something on your site? I suggest to test with creating policy for one of the Core modules.

  • πŸ‡¦πŸ‡²Armenia Alen Simonyan

    Hi Adam,
    I also tried with one of the core modules and it behaves the same

    https://drive.google.com/file/d/1X7qqCv8DMaqXBZTSUGuKdzdOqpFZPy49/view?usp=sharing

  • πŸ‡ΊπŸ‡ΈUnited States scotthreha

    I just completed a Drupal 10 upgrade and I'm getting this same error when I try to add a new element to an existing policy. It worked without problems during the entire development process, but now that I've pushed the upgrade to production it fails.

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\symfony_mailer\Processor\EmailAdjusterManager are: mailer_url_to_absolute, email_bcc, email_body, email_cc, mailer_default_headers, email_from, mailer_hooks, mailer_inline_css, email_plain, email_priority, email_reply_to, email_skip_sending, email_subject, email_theme, email_to, email_transport, mailer_wrap_and_convert in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /var/www/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

    I should add that this is a policy for email receipts in Drupal Commerce.

Production build 0.69.0 2024