When displaying nodes using Views and it's translation features, and using Display Suite as the row plugin, the configured alternating view modes and other configurations (like advanced view mode hook) are not taken into account.
It seems that the "preRenderByRelationship" method is not implemented at all, resulting in the default behavior being used.
Here is a patch that fix this issue, but maybe not the most efficient way.
Issue fork ds-3025928
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3025928-translationlanguagerenderer-not-using
changes, plain diff MR !18
Comments
Comment #2
renrhafComment #3
renrhafPatch explained
Remove the default views preRender behavior as it implies rendering useless markup because it gets overriden by DS configurations later.
Adds the override of the preRenderByRelationship method, if not, only the views default behavior is used which implies using the default view mode configured on the view, and not considering DS ones.
Move the code logic from the previous dsPreRender method to this new one.
Comment #4
renrhafComment #6
renrhafRerolled against 8.x-3.x
Comment #7
swentel commentedComment #8
swentel commentedComment #9
cbccharlie commentedI attached a new patch for 8.3.4 module version.
Please, could you test it?
Comment #10
swentel commentedAltered heavily by #3191628: Bring back 'delta' rendering, but will look at it soon.
Comment #11
swentel commentedPinging myself again, need to get this in soon
Comment #12
swentel commentedAs far as I can see, this seems to be working for me, unless I've done something wrong in my setup - maybe after #3191628: Bring back 'delta' rendering?
But I could be wrong, so if this is still a problem, please reopen!
Comment #13
javier_rey commentedThis issue is related to "Cannot use relationship for rendered entity on Views". Applying the core patch, the display suite module breaks and ignores the "Alternating View Mode" option
Comment #14
javier_rey commentedRelated to my previous comment, I have uploaded a patch that fixes the display suite "alter view mode" option when applying the core patch.
Comment #15
swentel commentedAh ok, I'll reopen the issue to keep tracking this.
Comment #16
swentel commentedComment #17
swentel commentedPostponed until the core patch goes in.
Comment #18
swentel commentedCore patch is in, but only in 10.1.x (for now)
Comment #19
cbccharlie commentedI attached a new patch for 8.x-3.15 module version.
Comment #20
klaasvw commentedThis patch is compatible with drupal core 9.5.x using the patch from https://www.drupal.org/project/drupal/issues/2457999#comment-14853680
Comment #21
klaasvw commentedForgot fixing the TranslationLanguageRenderer; new patched attached.
Comment #25
swentel commentedmoving back to 8.x-3.x
Comment #26
swentel commentedComment #27
swentel commentedre-roll against 8.x-3.x
Comment #29
swentel commentedcommitted and pushed, thanks!
(note my version is smaller because I've added a 'continue' in dsPreRender when checking if the entity exists or not.
Comment #30
swentel commented