Drupal 10 compatibility issues

Created on 15 September 2022, about 2 years ago
Updated 25 June 2024, 5 months ago

Problem/Motivation

Hello project maintainers,

This issue is to help make this module compatible with Drupal 10.

Patches will be added to this issue that remove Drupal 10 deprecated API uses.

Remaining tasks

------ ---------------------------------------------------------------------------------------------------------------
Line src/Plugin/Condition/NodeType.php
------ ---------------------------------------------------------------------------------------------------------------
11 Class Drupal\ctools\Plugin\Condition\NodeType extends deprecated class Drupal\node\Plugin\Condition\NodeType:
in drupal:9.3.0 and is removed from drupal:10.0.0.
Use \Drupal\Core\Entity\Plugin\Condition\EntityBundle instead.
------ ---------------------------------------------------------------------------------------------------------------

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇳India S_Bhandari

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.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • 🇧🇪Belgium aimevp Belgium

    I get that the patch was not the correct way to fix the issue but nevertheless there's still an issue in Ctools when using this feature on D10 because D10 no longer has the class "Drupal\Node\\Plugin\\Condition\NodeType". It was removed as stated in the deprecation message. Imho Ctools is not D10 compatible as it generates errors trying to read this deprecated condition plugin. We need a patch that removes this plugin instead of renaming use statements etc...

    This is the error I get when I try to create a new "entity_view (Content) block:

    An AJAX HTTP error occurred.
    HTTP Result Code: 500
    Debugging information follows.
    Path: /admin/structure/block/add/entity_view
    StatusText: 500 Service unavailable (with message)
    ResponseText: The website encountered an unexpected error. Please try again later.
    Error: Class "Drupal\Node\\Plugin\\Condition\NodeType" not found in include() (line 19 of modules/contrib/ctools/src/Plugin/Condition/NodeType.php). 
    
    Composer\\Autoload\\{closure}() (Line: 427)
    Composer\\Autoload\\ClassLoader->loadClass()
    ReflectionClass->;__construct() (Line: 94)
    Drupal\\Component\\Plugin\\Discovery\\AttributeClassDiscovery->getDefinitions() (Line: 55)
    Drupal\\Core\\Plugin\\Discovery\\AttributeDiscoveryWithAnnotations->getDefinitions() (Line: 86)
    Drupal\\Component\\Plugin\\Discovery\\DerivativeDiscoveryDecorator->getDefinitions() (Line: 309)
    Drupal\\Core\\Plugin\\DefaultPluginManager->findDefinitions() (Line: 194)
    Drupal\\Core\\Plugin\\DefaultPluginManager->getDefinitions() (Line: 23)
    Drupal\\Core\\Condition\\ConditionManager->getDefinitionsForContexts() (Line: 21)
    Drupal\\Core\\Condition\\ConditionManager->getFilteredDefinitions() (Line: 229)
    Drupal\\block\\BlockForm->buildVisibilityInterface() (Line: 129)
    Drupal\\block\\BlockForm->form() (Line: 106)
    Drupal\\Core\\Entity\\EntityForm->buildForm()
    call_user_func_array() (Line: 536)
    Drupal\\Core\\Form\\FormBuilder->retrieveForm() (Line: 283)
    Drupal\\Core\\Form\\FormBuilder->buildForm() (Line: 48)
    Drupal\\Core\\Entity\\EntityFormBuilder->getForm() (Line: 27)
    Drupal\\block\\Controller\\BlockAddController->blockAddConfigureForm()
    call_user_func_array() (Line: 123)
    Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 583)
    Drupal\\Core\\Render\\Renderer->executeInRenderContext() (Line: 121)
    Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 166)
    Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw() (Line: 74)
    Symfony\\Component\\HttpKernel\\HttpKernel->handle() (Line: 58)
    Drupal\\Core\\StackMiddleware\\Session->handle() (Line: 48)
    Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle() (Line: 61)
    Drupal\\tkp_forgerock\\StackMiddleware\\ForgerockHeaders->handle() (Line: 48)
    Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\\Core\\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
    Drupal\\Core\\StackMiddleware\\StackedHttpKernel->handle() (Line: 704)
    Drupal\\Core\\DrupalKernel->handle() (Line: 21)
    

    I've also changed this to major because I'm guessing this is breaking for sites that use this and upgrade from D9 to D10.
    Included is a patch (compatible for v4) which removes the plugin.

    Maybe what we really need asap is a dev version of 4.1.x or 5.x (only D10+ compatible) where this plugin has been removed.

  • 🇺🇸United States yesct

    Can this issue be closed? https://www.drupal.org/project/ctools already says the current version (4.0.4) is D10 compatible.

  • Merge request !59Fallback to node entity bundle instead. → (Merged) created by japerry
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    63 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    63 pass
  • 🇺🇸United States japerry KVUO

    The only way comment #6 could be reached is with an existing block using the node_type condition plugin. Additionally, something would need to define the plugin condition in Drupal 10+.

    The MR removes node type from Drupal 10, and transforms it to use EntityBundle in D9. If you wish to use node_type in D10, you would need to implement the node_type definition within hook_condition_info_alter

  • Pipeline finished with Skipped
    6 months ago
    #184533
  • Status changed to Fixed 6 months ago
  • 🇺🇸United States japerry KVUO

    Reviewed with eclipsegc, and the MR should fix this issue. There might be random issues for sites upgrading, for those cases please open a new issue

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

Production build 0.71.5 2024