Error: Call to undefined method Drupal\node\Entity\Node::getThread()

Created on 19 March 2024, 6 months ago
Updated 29 March 2024, 6 months ago

I'm getting this message on my home page after installing the module.

Whitescreen error message:
Error: Call to undefined method Drupal\node\Entity\Node::getThread() in comment_on_top_views_pre_render() (line 99 of modules/contrib/comment_on_top/comment_on_top.module).

call_user_func_array() (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 408)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 1538)
Drupal\views\ViewExecutable->render() (Line: 131)
Drupal\views\Plugin\views\display\Block->execute() (Line: 1645)
Drupal\views\ViewExecutable->executeDisplay() (Line: 81)
Drupal\views\Element\View::preRenderViewElement() (Line: 61)
Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 106)
Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 116)
Drupal\layout_builder\SectionComponent->toRenderArray() (Line: 88)
Drupal\layout_builder\Section->toRenderArray() (Line: 318)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildSections() (Line: 278)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple() (Line: 339)
Drupal\Core\Entity\EntityViewBuilder->buildComponents() (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents() (Line: 281)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 238)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func_array() (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 859)
Drupal\Core\Render\Renderer->doCallback() (Line: 421)
Drupal\Core\Render\Renderer->doRender() (Line: 240)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States mortona2k Seattle

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

Comments & Activities

  • Issue created by @mortona2k
  • 🇺🇸United States mortona2k Seattle

    When I installed the module, it complained about being unable to install a field config.

    comment.comment.field_stick_comment_on_top_boole

    Looks like the Comment comment type is missing.

  • 🇮🇳India dineshkumarbollu

    Hi @mortona2k
    I tested the issue in my system, after installation won't get any error.

    Drupal 10.1
    php 8.2

  • 🇮🇳India Jasjeet Kaur Brar

    @mortona2k, I have installed the module with version 2.0 And the module was installed successfully as you can see in my attached screenshot link here: https://prnt.sc/9sLuVEV8B163
    ** I am using Drupal Version 10.2. I have installed module using composer . Can you please let me know if it is a version specific issue with Drupal ? And Thank You.

  • 🇺🇸United States mortona2k Seattle

    Drupal 10.2.4
    PHP 8.2
    Comment On Top 2.0.0

    The problem is that the comment comment type comes from the standard install profile, so other people might have it set up differently.

    The quick fix would be to copy that config into optional, that way it will be included on install, but not override it if it exists.

    The larger issue is that this module is dependent on specific comment and field configuration that you may not want to replicate. A deeper fix would be to allow you to choose which comment to activate and that adds the setting for it. Otherwise it's going to break if things aren't set up exactly the same.

    But, I think this module is a great idea and I hope it keeps growing.

  • 🇧🇦Bosnia and Herzegovina drale01 Sarajevo

    Drupal 10.2.2
    PHP 8.1.27

    I tried to provoke this error, but without success.
    I will try more when I have more time.

  • 🇺🇸United States mortona2k Seattle

    Try installing with the minimal install profile, that should trigger it.

  • 🇧🇦Bosnia and Herzegovina drale01 Sarajevo

    @mortona2k, you were right.

    A temporary solution for this problem on a minimal installation is before installing the comment_on_top module:

    1. Enable core comment module
    2. Go to /admin/structure/comment
    3. Make new comment type with exact name "comment"

    After that comment_on_top with minimal version 2.0.1 can be installed.

    As I said, this is a temporary solution and it needs deeper analyses to fixing this issue.
    Since this opens a new problem, the module works with only one correctly named comment type.

Production build 0.71.5 2024