Problem/Motivation
Ctools 3.8.0 and up introduced a breaking change to the Content Entity Field module that causes Drupal to think that the entity_field:node plugin no longer exists.
Full error output:
The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity_field:node" plugin does not exist. Valid plugin IDs for Drupal\Core\Condition\ConditionManager are: cohesion_master_template, request_param, context_all, context, http_status_code, request_domain, request_path_exclusion, user_status, view_inclusion, domain, has_moderated_content_type, moderation_dashboard_access, node_type, current_theme, request_path, user_role, webform, entity_bundle:block_content, entity_bundle:cohesion_custom_style, entity_bundle:cohesion_style_helper, entity_bundle:domain_path_redirect, entity_bundle:feeds_feed, entity_bundle:media, entity_bundle:menu_link_content, entity_bundle:node, entity_bundle:redirect, entity_bundle:shortcut, entity_bundle:taxonomy_term, entity_bundle:webform_submission, entity_bundle:paragraph in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('entity_field:node') (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('entity_field:node', Array) (Line: 59)
Drupal\Core\Condition\ConditionManager->createInstance('entity_field:node', Array) (Line: 81)
Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('entity_field:node') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('entity_field:node') (Line: 26)
Drupal\Core\Condition\ConditionPluginCollection->get('entity_field:node') (Line: 149)
Drupal\Component\Plugin\LazyPluginCollection->getIterator() (Line: 372)
Drupal\context\ContextManager->applyContexts(Object) (Line: 336)
Drupal\context\ContextManager->evaluateContextConditions(Object) (Line: 253)
Drupal\context\ContextManager->evaluateContexts() (Line: 241)
Drupal\context\ContextManager->getActiveContexts() (Line: 273)
Drupal\context\ContextManager->getActiveReactions() (Line: 44)
Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber->onSelectPageDisplayVariant(Object, 'render.page_display_variant.select', Object)
call_user_func(Array, Object, 'render.page_display_variant.select', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'render.page_display_variant.select') (Line: 224)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->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: 265)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 221)
Drupal\shield\ShieldMiddleware->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: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
- Have a drupal site with Ctools, context, and the context entity field modules enabled and in use (plus other dependencies).
- Create and use a entity field context
- Observe white screen error (see above) that breaks entire site, including admin side.
Proposed resolution
Ctools has marked the following class as deprecated: Drupal\ctools\Plugin\Deriver\EntityBundle; the class Drupal\Core\Entity\Plugin\Condition\Deriver\EntityBundle should be used instead. When updating this class, site no longer white screens and context entity field works again.
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
themodularlabComment #4
loze commentedThis works for me. Thank you!
Comment #5
maxdmayhew commented#2 worked for me! Thank you!
Comment #6
loze commentedThis does get rid of the error, however the function getEntityBundleLabel($entity_type) that this overrides is never called
and subsequently the Label for this condition is the same as the entity type which makes it difficult to distinguish in the list of conditions. See my screenshot.
Comment #8
loze commentedI think MR4 gets this working correctly.
Comment #9
loze commentedComment #13
daniel korte