The following error occurs when enabling the TranslateEntityProcessor for a facet of content type:

Error: Call to undefined method Drupal\node\Entity\NodeType::hasTranslation() in Drupal\facets\Plugin\facets\processor\TranslateEntityProcessor->build() (line 125 of modules/contrib/facets/src/Plugin/facets/processor/TranslateEntityProcessor.php).
Drupal\facets\Plugin\facets\processor\TranslateEntityProcessor->build(Object, Array) (Line: 297)
Drupal\facets\FacetManager\DefaultFacetManager->build(Object) (Line: 82)
Drupal\facets\Plugin\Block\FacetBlock->build() (Line: 203)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func('Drupal\block\BlockViewBuilder::preRender', Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 151)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 166)
Drupal\Core\Render\Renderer->renderPlaceholder('', Array) (Line: 659)
Drupal\Core\Render\Renderer->replacePlaceholders(Array) (Line: 544)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 139)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 140)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 258)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object) (Line: 131)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.response', Object) (Line: 184)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

CommentFileSizeAuthor
#3 2823545-3.patch1.15 KBmpp
#2 2823545-2.patch749 bytesmpp
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpp created an issue. See original summary.

mpp’s picture

FileSize
749 bytes

Attached a quick fix, ideally this would test for the proper interface.

mpp’s picture

Status: Active » Needs review
FileSize
1.15 KB

Using instanceof TranslatableInterface this time.

  • borisson_ committed 3d18651 on 8.x-1.x authored by mpp
    Issue #2823545 by mpp: Call to undefined method NodeType::hasTranslation...
borisson_’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Dane Powell’s picture

Just for the benefit of anyone else (like me) stumbling across this error and wondering about the cause, this probably occurs most commonly when you delete a taxonomy term that's referenced by a node or other entity. The root cause is that Drupal doesn't delete corresponding term references when you delete the term, leaving dangling tids in those term reference fields. When facets tries to load those missing terms, you get this error.

borisson_’s picture

Ah, that sounds like a good explanation, thanks @Dane Powell!