Cannot add or edit Legal documents as long as role_toggle is installed

Created on 15 November 2022, over 2 years ago
Updated 23 May 2023, almost 2 years ago

Problem/Motivation

As long as I have role_toggle installed I cannot add (/admin/structure/legal/add) a Legal document or edit an exisiting one.

The following error occurs:

The website encountered an unexpected error. Please try again later.
TypeError: Drupal\entity_legal\Form\EntityLegalDocumentForm::__construct(): Argument #3 ($currentUser) must be of type Drupal\Core\Session\AccountProxy, Drupal\role_toggle\RoleToggleCurrentUser given, called in /www/htdocs/…/mydomain.org/dev/web/modules/contrib/entity_legal/src/Form/EntityLegalDocumentForm.php on line 83 in Drupal\entity_legal\Form\EntityLegalDocumentForm->__construct() (line 67 of modules/contrib/entity_legal/src/Form/EntityLegalDocumentForm.php).
Drupal\entity_legal\Form\EntityLegalDocumentForm->__construct(Object, Object, Object, Object) (Line: 83)
Drupal\entity_legal\Form\EntityLegalDocumentForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\entity_legal\Form\EntityLegalDocumentForm') (Line: 210)
Drupal\Core\Entity\EntityTypeManager->getFormObject('entity_legal_document', 'add') (Line: 69)
Drupal\Core\Entity\HtmlEntityFormController->getFormObject(Object, 'entity_legal_document.add.default') (Line: 58)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 159)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
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: 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)

Maybe this issue has to be moved to role_toggle. I don't know.

Steps to reproduce

  • install role_toggle and entity_legal modules
  • patch entity_legal with 3262452-9 to be able to add/edit Legal documents
  • add a Legal document at /admin/structure/legal/add --> see the error
  • uninstall role_toggle
  • add a Legal document at /admin/structure/legal/add --> no error
  • install role_toggle
  • add a Legal document at /admin/structure/legal/add --> see the error again

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

4.0

Component

Code

Created by

🇩🇪Germany marco.b

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.

Production build 0.71.5 2024