Drupal 10 compatibility

Created on 25 April 2023, about 1 year ago
Updated 8 February 2024, 5 months ago

This module contains a plugin which makes use of ContextAwarePluginBase which was deprecated after Drupal 9.1 and removed in Drupal 10, this has been re-written in the pathauto module to use the ContextAwarePluginTrait which this module looks to be based off, so I would suggest that this module should do the same.

πŸ› Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom andy_w

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

Comments & Activities

  • Issue created by @andy_w
  • πŸ‡¬πŸ‡§United Kingdom andy_w
  • Status changed to Needs review about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom andy_w
  • πŸ‡¬πŸ‡§United Kingdom andy_w

    Additional to this Drupal 10 also requires all queries explicitly set accessCheck as part of the query (see https://www.drupal.org/node/3201242 β†’ ) therefore the request to fetch all view_mode_page_patterns requires ->accessCheck(TRUE) to support Drupal 10.

  • πŸ‡ΊπŸ‡ΈUnited States jerrac

    I just found this module and was trying it out on a new D10 site. Since I ran into the ContextAwarePluginBase error, I tried patching via Composer/cweagans/composer-patches.

    The 3356400-drupal-10-compatibility.patch file lets me see and use the full Add Pattern form, but when I submit, I get this error:

    The website encountered an unexpected error. Please try again later.
    
    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_type" plugin does not exist. Valid plugin IDs for Drupal\Core\Condition\ConditionManager are: request_path, current_theme, user_role, entity_bundle:block_content, entity_bundle:comment, entity_bundle:feeds_feed, entity_bundle:media, entity_bundle:menu_link_content, entity_bundle:node, entity_bundle:shortcut, entity_bundle:taxonomy_term, 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() (Line: 16)
    Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 59)
    Drupal\Core\Condition\ConditionManager->createInstance() (Line: 81)
    Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin() (Line: 80)
    Drupal\Component\Plugin\LazyPluginCollection->get() (Line: 26)
    Drupal\Core\Condition\ConditionPluginCollection->get() (Line: 160)
    Drupal\Core\Plugin\DefaultLazyPluginCollection->setInstanceConfiguration() (Line: 172)
    Drupal\Core\Plugin\DefaultLazyPluginCollection->addInstanceId() (Line: 294)
    Drupal\view_mode_page\Entity\ViewmodepagePattern->addSelectionCondition() (Line: 264)
    Drupal\view_mode_page\Form\PatternEditForm->buildEntity() (Line: 170)
    Drupal\Core\Entity\EntityForm->afterBuild()
    call_user_func_array() (Line: 1083)
    Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 579)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
    Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
    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: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 686)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    

    If I try to apply the interdiff.txt file alongside the .patch file, it fails to patch.

    If I try the interdiff.txt file on it's own, the full Add Pattern form does not show up, and I get another error. (That I failed to copy, sorry.)

    That's the end of my testing. Hope it might help.

  • πŸ‡¬πŸ‡§United Kingdom andy_w

    Thanks for identifying this issue jerrac, I have updated the patch now that the node_type condition has been removed (see https://www.drupal.org/project/drupal/issues/1932810 β†’ )

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Please see πŸ› Context exception when trying to create url (Drupal 10 is broken!) RTBC which is already RTBC'd. Should we close this one as duplicate?

  • πŸ‡¬πŸ‡§United Kingdom james.williams

    There are differences between the two patches. This one adds an access check to an entity query. The entity query is for config entities, so the access check is not actually strictly necessary, but it does no harm to add it (and adding it will stop static analysis from unnecessarily flagging it up). On the other hand, this one does not account for 'entity_bundle' as the plugin ID... I don't know if that's OK or not.

Production build 0.69.0 2024