Core issue #2457999: Cannot use relationship for rendered entity on Views is being considered for 8.3, but with that patch Search API views get a warning upon save:

Warning: Declaration of Drupal\search_api\Plugin\views\EntityTranslationRenderer::getLangcode(Drupal\views\ResultRow $row) should be compatible with Drupal\views\Entity\Render\TranslationLanguageRenderer::getLangcode(Drupal\views\ResultRow $row, $relationship = 'none') in require() (line 12 of modules/contrib/search_api/src/Plugin/views/EntityTranslationRenderer.php).
require('/var/www/drupalvm/drupal/docroot/modules/contrib/search_api/src/Plugin/views/EntityTranslationRenderer.php') (Line: 110)
Symfony\Component\ClassLoader\ApcClassLoader->loadClass('Drupal\search_api\Plugin\views\EntityTranslationRenderer')
spl_autoload_call('Drupal\search_api\Plugin\views\EntityTranslationRenderer') (Line: 81)
Drupal\search_api\Plugin\views\EntityFieldRenderer->getEntityTranslationRenderer() (Line: 71)
Drupal\views\Entity\Render\EntityFieldRenderer->getCacheContexts() (Line: 1010)
Drupal\views\Plugin\views\field\Field->getCacheContexts() (Line: 171)
Drupal\Core\Cache\CacheableMetadata::createFromObject(Object) (Line: 2288)
Drupal\views\Plugin\views\display\DisplayPluginBase->calculateCacheMetadata() (Line: 326)
Drupal\views\Entity\View->addCacheMetadata() (Line: 300)
Drupal\views\Entity\View->preSave(Object) (Line: 434)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 389)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 259)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 637)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 986)
Drupal\views_ui\ViewUI->save() (Line: 312)
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('view_edit_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 226)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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}()
call_user_func_array(Object, Array) (Line: 144)
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)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kekkis created an issue. See original summary.

kekkis’s picture

Title: Edit Entity field renderers are adding relationships, causes interface incompatibility » Entity field renderers are adding relationships, causes interface incompatibility
kekkis’s picture

Title: Entity field renderers are adding relationships, causes interface incompatibility » Entity field renderers are adding relationships, causes inheritance incompatibility

Sorry for messing so badly with the title :)

kekkis’s picture

Here's the simple patch. I could really not figure out a use for the extra argument.

kekkis’s picture

Status: Active » Needs review
borisson_’s picture

Status: Needs review » Postponed

Let's not commit this yet, until an agreement is reached in #2457999: Cannot use relationship for rendered entity on Views. Postponing this issue.

drunken monkey’s picture

Agree with Joris, we should wait whether this even gets added to Core.
But thanks a lot for creating this issue anyways, very helpful!

Also, luckily, since the argument is optional, this won't make any problems for people using a Core version from before this change.

drunken monkey’s picture

Component: General code » Views integration
kekkis’s picture

As we're still using this patch in one of our projects, the change made in #3083923 necessitates a reroll.