When cloning the blocks it does not assign the correct language to the block.

Created on 11 August 2022, almost 2 years ago
Updated 25 September 2023, 9 months ago

Problem/Motivation

The cloned blocks from a library section aren't in the correct language. They are in the language that you created the library section item in.

This can cause all sorts of issues down the line with access checks on language. (as we have for a certain project)

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium nielsaers

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Merge request !14Update src/DeepCloningTrait.php β†’ (Open) created by nielsaers
  • πŸ‡§πŸ‡ͺBelgium weseze

    2 remarks on this approach:

    Templates that are stored in the library should have the language from the host entity from which they were cloned.
    With the changes you are proposing this could differ. Assume you are editing a page in a certain language (Chinese), while keeping the admin interface in another language (English). The current language would be English, but the template you are storing in the library should remain in the Chinese language, because it was cloned from a Chinese language page.

    Templates cloned into a page from the library should take on the language of the entity on which they are cloned.
    This is basically the same as the above, but in reverse.
    It also applies when you are simply translating your website and using templates created in another language.

    I suggest passing the host entity to the clone functions and getting the language from there.
    But I don't see anyway of doing that with the current code as it does not contain the host entity anywhere...

  • πŸ‡§πŸ‡ͺBelgium Thomas Cys

    Thomas Cys β†’ made their first commit to this issue’s fork.

  • Open on Drupal.org β†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    2 fail
Production build 0.69.0 2024