Problem/Motivation
I have got an error when using this module with Widget Notification contrib module. I can't save any Nodes on the site.
TypeError: Drupal\token_default\TokenDefaultManager::getReplacementsWithDefaults(): Argument #3 ($entity) must be of type Drupal\Core\Entity\EntityInterface, Drupal\Core\Session\AccountProxy given, called in /var/www/ats.loc/web/modules/contrib/token_default/src/TokenDefaultManager.php on line 45 in Drupal\token_default\TokenDefaultManager->getReplacementsWithDefaults() (line 97 of /var/www/ats.loc/web/modules/contrib/token_default/src/TokenDefaultManager.php)
#0 /var/www/ats.loc/web/modules/contrib/token_default/src/TokenDefaultManager.php(45): Drupal\token_default\TokenDefaultManager->getReplacementsWithDefaults()
#1 /var/www/ats.loc/web/modules/contrib/token_default/token_default.module(56): Drupal\token_default\TokenDefaultManager->replaceMissingTokensWithDefaults()
#2 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(562): token_default_tokens_alter()
#3 /var/www/ats.loc/web/core/lib/Drupal/Core/Utility/Token.php(368): Drupal\Core\Extension\ModuleHandler->alter()
#4 /var/www/ats.loc/web/modules/contrib/token/token.tokens.inc(1067): Drupal\Core\Utility\Token->generate()
#5 [internal function]: token_tokens()
#6 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array()
#7 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#8 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#9 /var/www/ats.loc/web/core/lib/Drupal/Core/Utility/Token.php(359): Drupal\Core\Extension\ModuleHandler->invokeAll()
#10 /var/www/ats.loc/web/core/lib/Drupal/Core/Utility/Token.php(241): Drupal\Core\Utility\Token->generate()
#11 /var/www/ats.loc/web/core/lib/Drupal/Core/Utility/Token.php(191): Drupal\Core\Utility\Token->doReplace()
#12 /var/www/ats.loc/web/modules/contrib/notificationswidget/src/Services/NotificationsWidgetService.php(150): Drupal\Core\Utility\Token->replace()
#13 /var/www/ats.loc/web/modules/contrib/notificationswidget/notifications_widget.module(135): Drupal\notifications_widget\Services\NotificationsWidgetService->logNotification()
#14 [internal function]: notifications_widget_entity_update()
#15 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array()
#16 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#17 /var/www/ats.loc/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#18 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(251): Drupal\Core\Extension\ModuleHandler->invokeAll()
#19 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook()
#20 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(598): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook()
#21 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave()
#22 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(523): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave()
#23 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(804): Drupal\Core\Entity\EntityStorageBase->save()
#24 /var/www/ats.loc/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#25 /var/www/ats.loc/web/modules/contrib/auto_entitylabel/src/Batch/ResaveBatch.php(24): Drupal\Core\Entity\EntityBase->save()
#26 /var/www/ats.loc/web/core/includes/batch.inc(295): Drupal\auto_entitylabel\Batch\ResaveBatch::batchOperation()
#27 /var/www/ats.loc/web/core/includes/batch.inc(137): _batch_process()
#28 /var/www/ats.loc/web/core/includes/batch.inc(93): _batch_do()
#29 /var/www/ats.loc/web/core/modules/system/src/Controller/BatchController.php(55): _batch_page()
#30 [internal function]: Drupal\system\Controller\BatchController->batchPage()
#31 /var/www/ats.loc/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#32 /var/www/ats.loc/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#33 /var/www/ats.loc/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#34 /var/www/ats.loc/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#35 /var/www/ats.loc/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#36 /var/www/ats.loc/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#37 /var/www/ats.loc/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#38 /var/www/ats.loc/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#39 /var/www/ats.loc/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#40 /var/www/ats.loc/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#41 /var/www/ats.loc/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#42 /var/www/ats.loc/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#43 /var/www/ats.loc/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#44 /var/www/ats.loc/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#45 /var/www/ats.loc/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#46 {main}| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Screenshot 2023-08-11 at 8.23.21 AM.png | 275.93 KB | keshavv |
| #6 | token_default-3380543.patch | 606 bytes | a.novolokov |
Issue fork token_default-3380543
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
a.novolokov commentedCreated MR for that, please review and merge that. Thanks!
Comment #4
a.novolokov commentedComment #6
a.novolokov commentedComment #7
keshavv commentedI am able to reproduce the issue and confirm that there is an issue and that the given patch works well.
Comment #10
andy_w commentedGreat spot and nice simple fix, thanks :)
Comment #11
andy_w commented