I am running a site on 8.1.2 with several contrib modules enabled. When visiting admin/structure/menu-position/add I get the following error:

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity_bundle" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Drupal\Core\Plugin\DefaultPluginManager->getDefinition('entity_bundle') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('entity_bundle', Array) (Line: 50)
Drupal\Core\Condition\ConditionManager->createInstance('entity_bundle') (Line: 125)
Drupal\menu_position\Form\MenuPositionRuleForm->form(Array, Object) (Line: 115)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 512)
Drupal\Core\Form\FormBuilder->retrieveForm('menu_position_rule_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('menu_position_rule_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lukas von Blarer created an issue. See original summary.

Lukas von Blarer’s picture

Issue summary: View changes
lbainbridge’s picture

Thanks for reporting this, would you mind also posting what contrib modules you are running? On a clean install I was unable to reproduce, so it seems likely that a contrib module with additional ConditionType plugins is interfering here. We are trying to be as agnostic and inclusive about conditions as possible, but it seems like we may need to implement some try/catch behaviour to avoid other modules possibly interfering with and breaking this one.

ckaotik’s picture

I encountered the same issue, I think this might be caused by the CTools Conditions plugins that apply generically to entity types.

Some example entries using entity_bundle of the $this->condition_plugin_manager->getDefinitions():

'entity_bundle:comment' => array(6)
    →'context' => array(1)
        →'comment' => object Drupal\Core\Plugin\Context\ContextDefinition(8) 
    'id' => string(13) "entity_bundle"
    'deriver' => string(42) "\Drupal\ctools\Plugin\Deriver\EntityBundle"
    'class' => string(43) "Drupal\ctools\Plugin\Condition\EntityBundle"
    'provider' => string(6) "ctools"
    →'label' => object Drupal\Core\StringTranslation\TranslatableMarkup(5) 
'entity_bundle:node' => array(6)
    →'context' => array(1)
        →'node' => object Drupal\Core\Plugin\Context\ContextDefinition(8) 
    'id' => string(13) "entity_bundle"
    'deriver' => string(42) "\Drupal\ctools\Plugin\Deriver\EntityBundle"
    'class' => string(43) "Drupal\ctools\Plugin\Condition\EntityBundle"
    'provider' => string(6) "ctools"
    →'label' => object Drupal\Core\StringTranslation\TranslatableMarkup(5) 
ckaotik’s picture

Did a temporary workaround to still allow for testing until this gets fixed properly :)

Lukas von Blarer’s picture

Status: Active » Needs work

The patch makes the module usable for me. What needs to be done to fix this?

g089h515r806’s picture

I have the same issue, the patch fixed.

akalata’s picture

Status: Needs work » Needs review
Lukas von Blarer’s picture

Status: Needs review » Needs work

According to the patch author this needs to be fixed different and needs tests.

ckaotik’s picture

Yup, my patch just fixes the symtoms that made configuring a MPR impossible. It doesn't touch the source of the problem.

We shouldn't exclude derived Condition plugins just because we don't know how to handle them yet ;)

ckaotik’s picture

Status: Needs work » Needs review
FileSize
656 bytes

Okay, I must have been blind. Finally found the problem, which should be fixed with the attached patch. No interdiff, as this is a proper solution instead of the previous try-catch workaround.

For derived Condition plugins, we were using $definition['id'] which is the base name, e.g. entity_bundle, where we should have used the derived name, i.e. entity_bundle:node.

realrudymartin’s picture

core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php file is missing from the latest 8.1.10 drupal.org download

Do I copy the text from https://www.drupal.org/node/2710911 or download this from elsewhere?

I assumed core modules and plugins are checked before release. What happened here?

ckaotik’s picture

@realrudymartin I think you might have gotten the wrong issue? :) This is for menu_position, which is not a core module.

Lukas von Blarer’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Thank you!

akalata’s picture

Bump, +1 for RTBC.

BarisW’s picture

Thanks for the patch, looks good to me.

  • BarisW committed d374f92 on 8.x-1.x authored by ckaotik
    Issue #2745295 by ckaotik, Lukas von Blarer, akalata, lbainbridge,...
BarisW’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

shefki’s picture

I have become the same error but not related to the "Menu position".
Hier is what I did that I become the error (I could reproduce the same error with the same steps):

I created a content type "section".
I created a view with containing this sections (Unformated list, Showen as fields, owerwrite result). with the path "/home"
I created a taxonomy vocabulary name "group" and in there the term "home" ...
In the "home" term I defined "/home" as URL Alias.
I added in the content type "section" a new field "Taxonomy term" and in the created nodes from that contenttype I selected "home".
And that's cousin the error, after that I could not reach the /home page. But after removing the URL Alias /home from the taxonomy term its working again.

PHP Version: 5.6.27,
Drupal version: 8.2.5

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "clean_empty" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('clean_empty') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('clean_empty', Array) (Line: 84)
Drupal\Component\Plugin\PluginManagerBase->createInstance('clean_empty', Array) (Line: 318)
template_preprocess_ds_entity_view(Array, 'ds_entity_view', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('ds_entity_view', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 65)
__TwigTemplate_e09f43b63eb6d88b322ab43d69076eecaf9d47519d36cbe55ad074956ae38ad9->doDisplay(Array, Array) (Line: 381)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 355)
Twig_Template->display(Array) (Line: 366)
Twig_Template->render(Array) (Line: 64)
twig_render_template('core/themes/stable/templates/views/views-view-unformatted.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render(Array, Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 448)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 87)
__TwigTemplate_4e3967b81cd7af3a34ebae61b369d9abb83be1efd13a206896a1f1874cb46fe7->doDisplay(Array, Array) (Line: 381)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 355)
Twig_Template->display(Array) (Line: 366)
Twig_Template->render(Array) (Line: 64)
twig_render_template('core/themes/stable/templates/views/views-view.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render(Array, Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 448)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 207)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 121)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 75)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
venoel’s picture

I catch this error after import database from production to development environment. Fixed by clearing all cache tables.