Allow Views to specify the langcode when rendering an entity in the Entity area plugin

Created on 15 February 2024, 11 months ago
Updated 17 February 2024, 11 months ago

Problem/Motivation

The rendered entity area plugins let you select an entity and the view mode to render in the header/footer regions of a View. But they don't allow the langocde param from the view_builder() method. In some cases Views may be rendered content other than the current language. Allowing the user to configure other entities rendered within the View to follow that language override would be useful.

Steps to reproduce

Add the language as a contextual argument or as a filter. Then your results will be in that language. But referenced entities in the header footer will always be in the language the site thinks they should be in (not following the row results language necessarily).

Proposed resolution

Allow a tokenized field in the Entity area plugin to pass a langcode.

Remaining tasks

None?

User interface changes

New field on the Entity area plugins.

API changes

None

Data model changes

None

Release notes snippet

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 15 hours ago

Created by

πŸ‡¨πŸ‡¦Canada minoroffense Ottawa, Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @minoroffense
  • πŸ‡¨πŸ‡¦Canada minoroffense Ottawa, Canada

    minorOffense β†’ changed the visibility of the branch 11.x to hidden.

  • Status changed to Needs review 11 months ago
  • πŸ‡¨πŸ‡¦Canada minoroffense Ottawa, Canada

    Likely going to need tests but figure get some eyes on it now in case something big needs changing.

    I was contemplating adding checks that the langcodes were valid but I'd have to do that on render since it supports tokens and I didn't want to slow stuff down. Figure drupal will just fallback to default if the langcode is bad.

  • πŸ‡¨πŸ‡¦Canada minoroffense Ottawa, Canada

    Here's what the field looks like in Views.

  • Status changed to Needs work 11 months ago
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Sounds a little edge case to me, don't think it makes the 80% criterium, especially with token support thrown in. Might be more user friendly with a select element showing available languages

    It would need some things I think:

    • should only be shown on multi-lingual sites
    • yeah validating if we have valid input sounds good, just hoping it falls back sounds bad
    • tests
    • a schema update
    • an upgrade path for the schema change
    • a test for the upgrade path
Production build 0.71.5 2024