Update deprecated entity bundle deriver plugin

Created on 11 August 2022, over 2 years ago
Updated 23 May 2024, 7 months ago

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

  1. Have a drupal site with Ctools, context, and the context entity field modules enabled and in use (plus other dependencies).
  2. Create and use a entity field context
  3. 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

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States themodularlab

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024