Not sure if this is a bug or a config error. When using the Vardoc distribution we are getting a compatibility error when using DS (Vardoc has prebuilt views for blogs, faq, etc) we confirmed this on a brand new test view as well.

Error log attached.

CommentFileSizeAuthor
#4 ds-getLangcode.patch771 bytesgyd
ds_lang_error.txt698 bytesrobertdown

Comments

robertdown created an issue. See original summary.

JoshuaKissoon’s picture

I'm getting the same error with the Drupal Distribution. Error reference for persons searching:

PHP Fatal error:  Declaration of Drupal\ds\Plugin\views\Entity\Render\TranslationLanguageRenderer::getLangcode(Drupal\views\ResultRow $row) must be compatible with Drupal\ds\Plugin\views\Entity\Render\DefaultLanguageRenderer::getLangcode(Drupal\views\ResultRow $row, $relationship = NULL) in /modules/ds/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php on line 11
JoshuaKissoon’s picture

Seems the issue is that an overridden method does not take the same parameters as the parent method.

Solution: Edit modules/ds/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php and change the function declaration:

public function getLangcode(ResultRow $row) {

TO

public function getLangcode(ResultRow $row, $relationship = NULL) {

It needs to have the $relationship argument even if it's not being used.

gyd’s picture

StatusFileSize
new771 bytes

It's maybe better to change function declaration of DefaultLanguageRenderer since EntityTranslationRendererBase does not include $relationship parameter

baikho’s picture

Status: Active » Closed (duplicate)
Related issues: +#2779243: Method declaration incompatibility

This seems to be already fixed in the dev branch.

elijah lynn’s picture

lois.chabrand’s picture

Hello,
thanks for the patch, works like a charm for me.

renrhaf’s picture

Thanks !