Problem/Motivation
ViewsReferenceExtrasCompressionReload overrides core's viewsreference.compression service so links generated by the embedded view (pager links, exposed filter form submissions) carry only compressed entity identifiers instead of the full serialized settings. On uncompress(), the parent entity is reloaded via $entity_storage->loadRevision($reload['parent_revision_id']) with no notion of language, then its Views Reference field is read directly.
On a multilingual entity whose Views Reference settings differ per translation (e.g. a "restrict results to this translation's language" setting, common on multilingual listing/search blocks), loadRevision() returns the entity's default translation. Any translation-dependent settings are then read from the wrong translation.
Concretely: viewing a non-default-language translation of a node whose embedded Views Reference block is configured to restrict results to that translation's language works correctly on first page load. But submitting the view's exposed filter form, or clicking a pager link - both of which carry the "reload" parameter - silently drops that language restriction because it's re-derived from the entity's default-language translation.
Steps to reproduce
- Create a translatable entity with a Views Reference field, enabled setting "Restrict to language" (or another per-translation setting).
- Give the default translation (e.g. English) one value for that setting, and a non-default translation (e.g. Spanish) a different value.
- View the non-default translation - the block reflects its own setting.
- Submit the exposed filter form (or click a pager link) - the setting reverts to whatever was configured on the default translation.
Proposed resolution
uncompress() should call $entity->getTranslation($langcode) - using the langcode the field was originally rendered in - before reading the field. This requires viewsreference to expose that langcode in the #viewsreference array; see companion issue #3609894 on the viewsreference project.
Remaining tasks
Depends on #3609894 (viewsreference) landing first.
Issue fork viewsreference_extras-3609896
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:
Comments
Comment #5
tyapchyc commentedComment #8
scott_euser commentedThank you! Added test coverage and merged