- Issue created by @infohome
- πΊπΈUnited States jerrac
I have a similar issue, not quite the same error message, and only the people admin view is blocked, but I think it's the same.
[Tue Aug 29 20:27:36.898101 2023] [php:notice] [pid 20] [client 10.212.134.11:0] TypeError: Drupal\\entity_copy_reference\\EntityCopyReference::isCopyEnabled(): Argument #1 ($node) must be of type Drupal\\node\\Entity\\Node, Drupal\\user\\Entity\\User given, called in /var/www/html/web/modules/contrib/entity_copy_reference/entity_copy_reference.module on line 71 in /var/www/html/web/modules/contrib/entity_copy_reference/src/EntityCopyReference.php on line 43 #0 /var/www/html/web/modules/contrib/entity_copy_reference/entity_copy_reference.module(71): Drupal\\entity_copy_reference\\EntityCopyReference->isCopyEnabled()\n#1 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(562): entity_copy_reference_entity_operation_alter()\n#2 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityListBuilder.php(114): Drupal\\Core\\Extension\\ModuleHandler->alter()\n#3 /var/www/html/web/core/modules/user/src/UserListBuilder.php(159): Drupal\\Core\\Entity\\EntityListBuilder->getOperations()\n#4 /var/www/html/web/core/modules/views/src/Plugin/views/field/EntityOperations.php(137): Drupal\\user\\UserListBuilder->getOperations()\n#5 /var/www/html/web/core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1158): Drupal\\views\\Plugin\\views\\field\\EntityOperations->render()\n#6 /var/www/html/web/core/modules/views/views.theme.inc(238): Drupal\\views\\Plugin\\views\\field\\FieldPluginBase->advancedRender()\n#7 [internal function]: template_preprocess_views_view_field()\n#8 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): call_user_func_array()\n#9 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\\Core\\Theme\\ThemeManager->render()\n#10 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\\Core\\Render\\Renderer->doRender()\n#11 /var/www/html/web/core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1746): Drupal\\Core\\Render\\Renderer->render()\n#12 /var/www/html/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(777): Drupal\\views\\Plugin\\views\\field\\FieldPluginBase->theme()\n#13 [internal function]: Drupal\\views\\Plugin\\views\\style\\StylePluginBase->elementPreRenderRow()\n#14 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()\n#15 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\\Core\\Render\\Renderer->doTrustedCallback()\n#16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\\Core\\Render\\Renderer->doCallback()\n#17 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\\Core\\Render\\Renderer->doRender()\n#18 /var/www/html/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(716): Drupal\\Core\\Render\\Renderer->render()\n#19 /var/www/html/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(582): Drupal\\views\\Plugin\\views\\style\\StylePluginBase->renderFields()\n#20 /var/www/html/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(470): Drupal\\views\\Plugin\\views\\style\\StylePluginBase->renderGrouping()\n#21 /var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2169): Drupal\\views\\Plugin\\views\\style\\StylePluginBase->render()\n#22 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1538): Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase->render()\n#23 /var/www/html/web/core/modules/views/src/Plugin/views/display/Page.php(199): Drupal\\views\\ViewExecutable->render()\n#24 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1635): Drupal\\views\\Plugin\\views\\display\\Page->execute()\n#25 /var/www/html/web/core/modules/views/src/Element/View.php(81): Drupal\\views\\ViewExecutable->executeDisplay()\n#26 [internal function]: Drupal\\views\\Element\\View::preRenderViewElement()\n#27 /var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()\n#28 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\\Core\\Render\\Renderer->doTrustedCallback()\n#29 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\\Core\\Render\\Renderer->doCallback()\n#30 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\\Core\\Render\\Renderer->doRender()\n#31 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\\Core\\Render\\Renderer->render()\n#32 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->Drupal\\Core\\Render\\MainContent\\{closure}()\n#33 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(235): Drupal\\Core\\Render\\Renderer->executeInRenderContext()\n#34 /var/www/html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->prepare()\n#35 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->renderResponse()\n#36 [internal function]: Drupal\\Core\\EventSubscriber\\MainContentViewSubscriber->onViewRenderArray()\n#37 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()\n#38 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher->dispatch()\n#39 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()\n#40 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\\Component\\HttpKernel\\HttpKernel->handle()\n#41 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\\Core\\StackMiddleware\\Session->handle()\n#42 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle()\n#43 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\\page_cache\\StackMiddleware\\PageCache->pass()\n#44 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\\page_cache\\StackMiddleware\\PageCache->handle()\n#45 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle()\n#46 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle()\n#47 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\\StackedHttpKernel->handle()\n#48 /var/www/html/web/index.php(19): Drupal\\Core\\DrupalKernel->handle()\n#49 {main}, referer: https://testsite/admin
Ended up combining my patch for this with an older one for an error I ran into when viewing entities that were copy enabled. So I'm just going to paste it as a code block instead of upload it.
Index: entity_copy_reference.module IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/entity_copy_reference.module b/entity_copy_reference.module --- a/entity_copy_reference.module +++ b/entity_copy_reference.module (date 1693345065482) @@ -49,6 +49,7 @@ 'title' => t('Copy'), 'url' => Url::fromRoute('entity_copy_reference.copy', [ 'node' => $node->id(), + 'localized_options' => [], ]), ], '#weight' => 2, @@ -62,15 +63,17 @@ * Implements hook_entity_operation_alter(). */ function entity_copy_reference_entity_operation_alter(&$operations, $entity) { - $entityCopyReference = new EntityCopyReference(); + if ($entity instanceof \Drupal\node\Entity\Node) { + $entityCopyReference = new EntityCopyReference(); - if ($entityCopyReference->isCopyEnabled($entity) && $entity->access('update')) { - $weight = (array_key_exists('edit', $operations)) ? $operations['edit']['weight'] + 1 : count($operations) + 1; + if ($entityCopyReference->isCopyEnabled($entity) && $entity->access('update')) { + $weight = (array_key_exists('edit', $operations)) ? $operations['edit']['weight'] + 1 : count($operations) + 1; - $operations['entity_copy_reference.copy'] = [ - 'title' => t('Copy'), - 'url' => Url::fromRoute('entity_copy_reference.copy', ['node' => $entity->id()]), - 'weight' => $weight, - ]; + $operations['entity_copy_reference.copy'] = [ + 'title' => t('Copy'), + 'url' => Url::fromRoute('entity_copy_reference.copy', ['node' => $entity->id()]), + 'weight' => $weight, + ]; + } } }
You can drop that as a file in Drupal's root directory/patches, then add something like this to composer's extra section:
"patches": { "drupal/entity_copy_reference": { "node type error fix": "patches/3347826-enitity_copy_reference_node_type_error_fix.patch" } }
- πΊπΈUnited States texas-bronius
Thank you @jerrac. I am having some kind of issue with local patches, so I will try a file fetch. At the same time, I simplified your patch down to just this issue's original intent (as I understand, your c/p patch here addresses something else you were doing for your environment).
How I tested it:
* Visit/admin/structure/menu
With the patch: See menu edit.
Without the patch: WSOD and the following in
- Status changed to Needs review
9 months ago 4:59am 10 February 2024 - πΊπΈUnited States texas-bronius
Please consider the patch in #3 based on @jerrace #2 above. It applies locally and fixes the problem exhibited for me.
Note: I could not could not could not initially get either of these patches to load until I deleted `patches.lock.json` and tried again. Phew!
"patches": { ... "drupal/entity_copy_reference": { "Edit Menu WSOD": "https://www.drupal.org/files/issues/2024-02-09/3347826-3-entity_copy_reference-fix-entity_alter.patch" } }
- Status changed to Fixed
6 months ago 4:13pm 20 May 2024 Thank you for the patches. Patch #3 β used in new release 1.0.2 β .
Automatically closed - issue fixed for 2 weeks with no activity.