Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::__construct(): Argument #8 ($token) must be of type Drupal\views\Plugin\EntityReferenceSelection\Token, Drupal\eca\Token\ContribToken given

Created on 4 May 2023, over 1 year ago

Problem/Motivation

The website encountered an unexpected error. Please try again later.
TypeError: Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::__construct(): Argument #8 ($token) must be of type Drupal\views\Plugin\EntityReferenceSelection\Token, Drupal\eca\Token\ContribToken given, called in mysite/web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php on line 118 in Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection->__construct() (line 96 of core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php).
Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection->__construct(Array, 'views', Array, Object, Object, Object, Object, Object) (Line: 118)
Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::create(Object, Array, 'views', Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('views', Array) (Line: 76)
Drupal\Component\Plugin\PluginManagerBase->createInstance('views', Array) (Line: 54)
Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getInstance(Array) (Line: 101)
Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getSelectionHandler(Object, Object) (Line: 619)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->getSettableOptions(Object) (Line: 91)
Drupal\Core\Field\TypedData\LegacyOptionsProvider->getSettableOptions(Object) (Line: 170)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase->getOptions(Object) (Line: 47)
Drupal\social_album\Plugin\Field\FieldWidget\SocialAlbumOptionsSelectWidget->getOptions(Object) (Line: 34)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsSelectWidget->formElement(Object, 0, Array, Array, Object) (Line: 66)
Drupal\social_album\Plugin\Field\FieldWidget\SocialAlbumOptionsSelectWidget->formElement(Object, 0, Array, Array, Object) (Line: 353)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 92)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 183)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 121)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 81)
Drupal\social_post\Form\PostForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('social_post_entity_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 173)
Drupal\social_post\Plugin\Block\PostBlock->build() (Line: 124)
Drupal\social_post\Plugin\views\area\SocialPostPostForm->render(1) (Line: 2292)
Drupal\views\Plugin\views\display\DisplayPluginBase->renderArea('header', 1) (Line: 2237)
Drupal\views\Plugin\views\display\DisplayPluginBase->elementPreRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 β†’ ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 118)
__TwigTemplate_xxx->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/socialbase/templates/block/block--views-block--activity-stream-block-stream-homepage.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 224)
__TwigTemplate_xxx->block_content(Array, Array) (Line: 182)
Twig\Template->displayBlock('content', Array, Array) (Line: 185)
__TwigTemplate_xxx->block_section(Array, Array) (Line: 182)
Twig\Template->displayBlock('section', Array, Array) (Line: 96)
__TwigTemplate_xxx->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/socialblue/templates/layout/page--sky.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 106)
__TwigTemplate_xxx->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/contrib/socialbase/templates/system/html.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 162)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 163)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 54)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 43)
Drupal\webform_product\RedirectMiddleware->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: 728)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

I logged into my site and got a WSOD

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Closed: works as designed

Version

1.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

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

Comments & Activities

  • Issue created by @SocialNicheGuru
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @SocialNicheGuru is there a way to reproduce this? Without any context, we can't analyse that problem. From the stack trace, it looks like there is a contrib module social_post in use and maybe there is something special going on.

    Please describe step by step, how this can be reproduced. Ideally you could also upload a simplified ECA model which contains all the calculated dependencies and lets us reproduce those steps without having to setup all from scratch ourselves.

  • πŸ‡©πŸ‡ͺGermany mxh Offenburg

    I rather believe that the OP is using a patch in his / her project from somewhere else or hacked Drupal Core's codebase, because

    Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::__construct() does not have a constructor argument #8 $token by default, and there is no Drupal\views\Plugin\EntityReferenceSelection\Token. It's very likely this error is not caused by ECA.

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

    I don't quite understand the error

    in html/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php on line 93 the doc gives:
    @param \Drupal\Core\Utility\Token $token

    in eca/src/Token/ContribToken.php, ContribToken extends Token.

    so even if the type is Drupal/eca/ContribToken would it not be covered.

    As a quick workaround I removed "Token" from the function definition:

    public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user, RendererInterface $renderer, $token)

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @SocialNicheGuru what version of Drupal core is it? I've checked 9.5.9 and 10.0.1 and both do NOT have token in the constructor of that class.

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

    I have just enabled ECA. I have not created any ECA rules.

    I HATE leaving these items that are not easily reproducible. I changed to support request. I did want to leave it here for others and to give me some more time to see if I can figure out why this happens.

  • Status changed to Closed: works as designed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    This is a problem with my install.
    I have a core patch that is causing the issue.
    This is not ECA.

Production build 0.71.5 2024