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
- 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.
- Select any element and press "Add Element".
- 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 -'),
];