Unable to edit Content Types after activating this module

Created on 5 July 2022, over 2 years ago
Updated 20 May 2024, 6 months ago

Problem/Motivation

After installing this module (using Composer) and configuring it, I can no longer edit fields of any Content type or even access the page for Content Types (/admin/structure/types). Instead I get a WSOD with the general "The website encountered an unexpected error. Please try again later." message. Log message is the following:

TypeError: Drupal\entity_copy_reference\EntityCopyReference::isCopyEnabled(): Argument #1 ($node) must be of type Drupal\node\Entity\Node, Drupal\node\Entity\NodeType given, called in C:\xampp\htdocs\ect\web\modules\contrib\entity_copy_reference\entity_copy_reference.module on line 70 in Drupal\entity_copy_reference\EntityCopyReference->isCopyEnabled() (line 43 of C:\xampp\htdocs\ect\web\modules\contrib\entity_copy_reference\src\EntityCopyReference.php)
#0 C:\xampp\htdocs\ect\web\modules\contrib\entity_copy_reference\entity_copy_reference.module(70): Drupal\entity_copy_reference\EntityCopyReference->isCopyEnabled(Object(Drupal\node\Entity\NodeType))
#1 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Extension\ModuleHandler.php(562): entity_copy_reference_entity_operation_alter(Array, Object(Drupal\node\Entity\NodeType), NULL)
#2 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Entity\EntityListBuilder.php(114): Drupal\Core\Extension\ModuleHandler->alter('entity_operatio...', Array, Object(Drupal\node\Entity\NodeType))
#3 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Entity\EntityListBuilder.php(193): Drupal\Core\Entity\EntityListBuilder->getOperations(Object(Drupal\node\Entity\NodeType))
#4 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Entity\EntityListBuilder.php(175): Drupal\Core\Entity\EntityListBuilder->buildOperations(Object(Drupal\node\Entity\NodeType))
#5 C:\xampp\htdocs\ect\web\core\modules\node\src\NodeTypeListBuilder.php(37): Drupal\Core\Entity\EntityListBuilder->buildRow(Object(Drupal\node\Entity\NodeType))
#6 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Entity\EntityListBuilder.php(219): Drupal\node\NodeTypeListBuilder->buildRow(Object(Drupal\node\Entity\NodeType))
#7 C:\xampp\htdocs\ect\web\core\modules\node\src\NodeTypeListBuilder.php(57): Drupal\Core\Entity\EntityListBuilder->render()
#8 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Entity\Controller\EntityListController.php(23): Drupal\node\NodeTypeListBuilder->render()
#9 [internal function]: Drupal\Core\Entity\Controller\EntityListController->listing('node_type')
#10 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#11 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\Render\Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#13 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#14 C:\xampp\htdocs\ect\vendor\symfony\http-kernel\HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 C:\xampp\htdocs\ect\vendor\symfony\http-kernel\HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#16 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\StackMiddleware\Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 C:\xampp\htdocs\ect\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 C:\xampp\htdocs\ect\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 C:\xampp\htdocs\ect\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 C:\xampp\htdocs\ect\web\core\lib\Drupal\Core\DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 C:\xampp\htdocs\ect\web\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#25 {main}
.

Steps to reproduce

  1. Install a fresh Drupal 9 (version 9.4.1) and install the module using Composer (either 1.0.0 or 1.0.x-dev)
  2. Configure the module in any way
  3. In the Admin-Backend try to access the Content types (/admin/structure/types) and you'll get the error

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

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

  • Problem/Motivation

    When activating/Installing the "Entity Copy with Reference" extension/module (which is available ) after installing the 'entity_copy_reference 101) module, all main drupal menu at "/admin/structure/" such as Content Types (admin/structure/types) and Comment (admin/structure/comment) , and all the others (block/ccontant/display/...,view) are not accessible . Situation returns to normal when when the 'entity copy reference' is 'removed/uninstalled' from the Extend list.

    I am using Drupal 10 PHP 8.1.16 on a standard/shared cpanel hosting account.
    I was installing the drupal via ZIP extract install method (not via composer method) on the following directory "/public_html//mysubdomain.com/mysubfolder/"
    The drupal web is accessible on the following domain "www.mydomain.com/myfolder/" not from "www.mydomain.com"
    I have not been performing any 'direct hard coding ' modifications method at all, I've only preform standard drupal install/uninstall composer (via terminal), and install/uninstall via Extend Menu. there are other extensions/plugins which I have installed since the fresh install, and most of them are ok, never shows this kind of error.
    --
    the error message shown in the drupal "admin/reports/dblog/event/312" is as follows:

    TypeError: Drupal\entity_copy_reference\EntityCopyReference::isCopyEnabled(): Argument #1 ($node) must be of type Drupal\node\Entity\Node, Drupal\node\Entity\NodeType given, called in /home/commyhos/public_html/mydomain.com/myfolder/modules/contrib/entity_copy_reference/entity_copy_reference.module on line 70 in Drupal\entity_copy_reference\EntityCopyReference->isCopyEnabled() (line 43 of /home/commyhos/public_html/mydomain.com/myfolder/modules/contrib/entity_copy_reference/src/EntityCopyReference.php).

    Steps to reproduce

    Step 1. Terminal : composer require 'drupal/entity_copy_reference:^1.0'
    Step 2. Drupal Menu : INSTALL the extension 'Entity Copy Reference (this part seem to cause error/problem in the main drupal menus (content type/comments /others)
    Step 3. try to enter the 'Content Type' or 'Comment' menu (or al menu within the STRUCTURE http://yourdomain.com/admin/structure/ ) ,and it will show a blank page with 'one line sentence' error message =

    "The website encountered an unexpected error. Please try again later."

    I've retried the steps a few times and the problems still exists

  • 🇺🇸United States duckydan

    I ran into this exact thing.

    TypeError: Drupal\entity_copy_reference\EntityCopyReference::isCopyEnabled(): Argument #1 ($node) must be of type Drupal\node\Entity\Node, Drupal\node\Entity\NodeType given, called in /var/www/html/beta.weavercafe/web/modules/contrib/entity_copy_reference/entity_copy_reference.module on line 70 in Drupal\entity_copy_reference\EntityCopyReference->isCopyEnabled() (line 43 of /var/www/html/beta.weavercafe/web/modules/contrib/entity_copy_reference/src/EntityCopyReference.php).

    I am on Drupal 10.1.7 and PHP 8.1.12.

    I am going to change this to major since it does not work with the current version of Drupal.

  • Status changed to Needs review 11 months ago
  • 🇮🇳India dineshkumarbollu

    created patch for this /entity_copy_reference/src/EntityCopyReference.php line 70 excepting Node,Added condition in patch please review.

  • 🇪🇬Egypt rami.sedhom

    Patch in comment #4 worked with me, thanks @dineshkumarbollu

    How to push this to be released in next version?

  • Status changed to Closed: duplicate 6 months ago
Production build 0.71.5 2024