Allow synced Layout override Translations: translating labels and inline blocks

Created on 21 February 2018, over 7 years ago
Updated 27 March 2023, over 2 years ago

Problem/Motivation

follow up #3041659: Remove the layout tab from translations because Layout Builder does not support translations yet

Part of #3044386: [META] Make Layout Builder layouts translatable

Right now you are not able to translate layouts at all.

The most common use case is probably translating the block labels and inline blocks but having the actual layouts not change from language to language. For different layout per language: see #3040487: Allow Independent Layout Override Translations

Proposed resolution

  1. Provide access to the Layout table on translations
  2. On Translations the Layout builder would only allow translating labels and inline blocks
  3. Translated settings for block would be stored a new field that would be translatable(the current Layout field would still be untranslatable)
  4. Most blocks could only have labels as translated settings
  5. Inline blocks could additionally have a block revision ID stored.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

10.1

Component
Layout builder 

Last updated 25 days ago

Created by

🇷🇺Russia Chi

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • 🇮🇳India sahil.goyal

    updating a quick fix for the #299 CCF.

  • Status changed to Needs review over 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 2 years ago
    Custom Commands Failed
  • heddn Nicaragua

    Rerolled again.

  • Status changed to Needs work over 2 years ago
  • 🇺🇸United States smustgrave

    Leaving the needs upgrade path tests as the current test does not do any assertion before running updates.

    CC failure but if it was reroll there was failures in 301

  • 🇺🇦Ukraine nginex

    Tried with MR but the fork is outdated and I can't get 11.x version.

    Tried to create an interdiff file, also failed.

    So this is reroll MR 1504 against 11.x

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Custom Commands Failed
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Custom Commands Failed
  • 🇺🇦Ukraine nginex

    Fixed issues from PHPStan

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Custom Commands Failed
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Custom Commands Failed
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Custom Commands Failed
  • 🇺🇦Ukraine nginex

    Sorry, phpcs issues was missed. Here is a new patch.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    29,445 pass, 7 fail
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    34:08
    31:45
    Running
  • 🇺🇦Ukraine nginex

    The patch #307 now applies successfully, but need to fix/improve new tests, the full report is available in the job

  • 🇬🇧United Kingdom webfaqtory

    I have posted a patch in Fix multilingual site's layout edit context issue with TypeError: Argument 1 passed to UrlHelper::buildQuery() must be of the type array, null given 🐛 Fix multilingual site's layout edit context issue with TypeError: Argument 1 passed to UrlHelper::buildQuery() must be of the type array, null given Needs work as I was getting this error when trying to access a translation's layout builder in D10.1.2.

    I have fixed the missing $args['route_parameters'] (they are availabe in $contextual_links['layout_builder_block_translation'] or $contextual_links['layout_builder_inline_block_translation']) and everything now works.

    Maybe someone can check why this patch is required and fix the missing $args['route_parameters'] when _contextual_links_to_id($contextual_links) is called. I am using the 2946333-d10-307.patch

  • last update about 2 years ago
    Custom Commands Failed
  • Status changed to Needs review about 2 years ago
  • last update about 2 years ago
    30,136 pass
  • 🇮🇳India gauravvvv Delhi, India

    I have fixed the cc failure, added use statement for ClientException and updated elseif condition, Attached patch and interdiff for same

  • Status changed to Needs work about 2 years ago
  • 🇺🇸United States smustgrave

    Was previously tagged for tests and upgrade path which still need to happen.

    Did not review as there’s more to don

  • 🇬🇧United Kingdom webfaqtory

    We need an update of 2946333-d10-307.patch for D10.2.x. When issuing composer update to update from 10.1.7 to 10.2.0 I'm getting:

    Cannot apply patch Drupal Layout Builder. Allow synced Layout override Translations (https://www.drupal.org/files/issues/202
      3-07-25/2946333-d10-307.patch)!
  • heddn Nicaragua

    Rebased the previous MR on a new MR that is based on 11.x. Fixed some obvious cruft that made its way into the patch file. And updated the deprecation strings. But we still have a lot of needs... tags, so this still needs more work.

  • heddn Nicaragua

    heddn changed the visibility of the branch 9.4.x to hidden.

  • heddn Nicaragua

    heddn changed the visibility of the branch 2946333-allow-synced-layout to hidden.

  • Pipeline finished with Failed
    almost 2 years ago
    Total: 292s
    #68491
  • last update over 1 year ago
    25,769 pass, 1,831 fail
  • last update over 1 year ago
    Patch Failed to Apply
  • First commit to issue fork.
  • Pipeline finished with Failed
    over 1 year ago
    Total: 173s
    #85259
  • Pipeline finished with Failed
    over 1 year ago
    Total: 174s
    #98520
  • Pipeline finished with Failed
    over 1 year ago
    Total: 170s
    #98639
  • 🇦🇹Austria jordik

    The latest MR5956 did not apply on D10.2.3, stopping at core/modules/layout_builder/layout_builder.services.yml.
    Here is the re-roll for D10.2. as a patch.

  • 🇨🇦Canada joseph.olstad

    Went through coding standards errors and made corrections.

  • Pipeline finished with Failed
    over 1 year ago
    Total: 176s
    #100021
  • Status changed to Needs review over 1 year ago
  • Pipeline finished with Failed
    over 1 year ago
    Total: 570s
    #100024
  • Pipeline finished with Failed
    over 1 year ago
    #100032
  • Pipeline finished with Running
    over 1 year ago
    #100039
  • Pipeline finished with Failed
    over 1 year ago
    Total: 597s
    #100054
  • 🇨🇦Canada joseph.olstad

    Only one small test error left, have to spin up a vanilla environment with the spark theme enabled as well as this patch going in order to figure it out.

  • 🇨🇦Canada joseph.olstad

    @heddn, this is one of the tests you wrote, one last test fix and it'll be ready to go, can you please have a look?

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    Left some comments, mostly small stuff.

    Leaving needs update path tests though as I didn't see those.

    Also such a change seems like will need a change record

  • 🇬🇧United Kingdom webfaqtory

    I applied the patch 2946333-319.patch by JordiK to D10.2.3 but there is no edit icon when hovering over a block in Layout builder. Also if my patch 3101231-D10-allow-synced-layout-override-translations.patch is not applied then back to the error TypeError: Drupal\Component\Utility\UrlHelper::buildQuery(): Argument #1 ($query) must be of type array, null given

  • 🇮🇳India mithun s Bangalore

    Mithun S made their first commit to this issue’s fork.

  • Pipeline finished with Failed
    over 1 year ago
    Total: 174s
    #114367
  • 🇮🇳India adwivedi008

    Revised #319 as it cleanly applies for D-10.2.x but was facing an issue with the pencil icon on the layout translation page.

    Fixed the issue.

    Please review and suggest if any other change is required

  • 🇬🇧United Kingdom webfaqtory

    I applied the revised patch #327 and still don't get the pencil icon on translated pages when in Layout.

    The above is what I get when editing the layout of a translated node on a clean install of D10.2.4. Only the drag/drop icon shows anywhere in the block

  • Pipeline finished with Failed
    over 1 year ago
    Total: 172s
    #130164
  • Pipeline finished with Failed
    over 1 year ago
    Total: 175s
    #130168
  • Fixed the issue with the note appearing contextual links as mentioned in #325 and #328. To those people who still upload patches in this massive issue: Nobody will see what you changed if you don't at least upload an interdiff along with your patch. But even if you do and there's an MR in the issue, please just use the MR to push your changes, that will make collaboration much easier.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇬🇧United Kingdom webfaqtory

    I'm trying to add the 10.2.x fork to my composer.json (sorry never done this before) I have this under repositories:

     {
                "type": "vcs",
                "url": "https://git.drupalcode.org/issue/drupal-2946333.git"
            }

    But I don't know what to put under require for the 2946333_3049332_combined-10.2.x branch and would it replace the drupal/core requirement?

  • Pipeline finished with Failed
    over 1 year ago
    Total: 172s
    #204604
  • Pipeline finished with Failed
    over 1 year ago
    Total: 186s
    #204606
  • Pipeline finished with Failed
    over 1 year ago
    Total: 783s
    #204609
  • 🇺🇸United States smustgrave

    So you only need 1 MR pointed at 11.x can close the others

  • Was this pushed to the core? Is there a way to translate titles added with Layout Builder without applying a patch now?

  • 🇩🇰Denmark J_Drupal Copenhagen

    It looks like the MR for 10.3 is not working properly.
    I am using this patch: https://git.drupalcode.org/project/drupal/-/merge_requests/8480.diff which applies fine, but blocks added with layout builder cannot be translated.

  • What does that patch allow us to translate?

  • 🇬🇪Georgia almador

    I'm on Drupal 10.3.1 and using layout_builder_st (Layout Builder Symmetric Translations) with patches for Drupal 10 compatibility, but I've noticed some errors with xdebug and ended with this issue.

    Am I right that the patch from this issue should resolve the same thing Layout Builder Symmetric Translations is attempted to fix?

    If yes, I'd prefer to remove Layout Builder Symmetric Translations and install the patch, but which patch works for 10.3.x?

  • Pipeline finished with Failed
    about 1 year ago
    Total: 130s
    #248107
  • 🇪🇸Spain joe_carvajal Seville (Spain)

    Subscribe to this issue, I think that Symettric translations should be covered by core, leaving the Asymettric translations in the already stable contrib module.

  • 🇧🇪Belgium L_VanDamme

    This patch is causing problems when reverting revisions.

    This is because of the getActive call that was added to retrieve the latest version of the block when editing in stead of the saved revision. I believe it was added to prevent EntityChangedConstraint errors, but they were fixed in https://www.drupal.org/project/drupal/issues/3053881 .

    Steps to reproduce this:

    1. Create a page with a text block with title AAAA.
    2. Update the page and change the text block title to BBBB.
    3. Revert back to the first version.
    4. The block title is now AAAA. But when you open the edit form of the block, it shows BBBB (the latest revision)

    Code that is causing this behavior (in InlineBlock::blockForm()):

        if (!$this->isNew && !$block->isNew() && empty($this->configuration['block_serialized'])) {
          // Get the active block for editing purposes.
          $block = $this->entityRepository->getActive('block_content', $block->id());
        }
    

    I think there might also be other places that this getActive function is called to prevent the error where it is no longer needed.

    I would be willing to update the patch, but have not been active in creating it, so I'm not sure about what I might be breaking when removing this code.

  • 🇩🇪Germany Anybody Porta Westfalica

    @l_vandamme: I think the patch is just a static copy from the MR here. Please adjust it there to proceed with the final fix. Patches can then be downloaded statically from there to use with composer patches for example. Thanks!

    layout_builder_st is still not D11 compatible and both maintainers seem inactive and do not repond on PM. Maybe someone should request maintainership until this is fixed?

  • 🇩🇪Germany Istari

    mysdiir made their first commit to this issue’s fork.

  • Pipeline finished with Failed
    10 months ago
    Total: 112s
    #364379
  • 🇩🇪Germany Istari

    Added a new 10.3.x backport made with the base of 2946333-11.x-rebase.
    MR !10504

  • 🇬🇪Georgia almador

    Could someone clarify if using the MR!10504 is enough to replace the Layout Builder Symmetric Translations functionality?

    I'm using Drupal 10.4.0 right now and feel exhausted fighting with layout_builder_st problems, currently, it's not allowing me to clear caches from the Drupal admin interface.

  • 🇩🇪Germany Hydra

    The MR for @mysdiir worked for my 10.4 setup, thx for that!
    I ran into an issue which gave me a hard time to understand whats going on, I'll try my best to describe this:
    - Create a new block in a layout
    - Save and then switch the language to create a translation for this block
    - The block created in the source language now is not shown anymore

    What I found out is, that the creation of the translation, created a new revision for all languages. But since blocks in layout_builder are referenced by the block_revision_id, the method isBlockRevisionUsedInEntity in SetInlineBlockDependency no longer returns TRUE when determination of the layout_entity takes place, which will be used to inherit the access to the block. This even get's worse when using a paragraph on that block, which also tries to inherit the access.

    I have no idea if the other language versions of the layout should be getting updated or if the isBlockRevisionUsedInEntity method should take the latest affected revision in consideration for it's lookup and of course the block_revision_id from the translation as well (currently it always uses the source for that).

    To be sure (because it should be backwards compatible and not changing data) I decided to go for the second approach and created this little helper module, which should be obsolete when this gets fixed, or someone gives me a hint what I am doing wrong :)

  • Pipeline finished with Failed
    9 months ago
    Total: 139s
    #400575
  • 🇧🇪Belgium L_VanDamme

    Rebased the MR from 11.x.

    As far as I can tell, it still has issues when editing changed blocks after reverting revisions. I might take a look at that later, for now, it should work as before and apply to 11.x.

  • 🇨🇦Canada smulvih2 Canada 🍁

    This would be great to get done, so we don't need to rely on layout_builder_st which has been lagging for D11 support.

  • I had issues with language negotiation, when using the detection method "Content language" (/admin/config/regional/language/detection) there were problems like: the translation link would actually be modifying the original English version or in a more complex situation the interface language would be set to French and the content language would be set to Japanese, the block would appear in Japanese but the translation from the contextual menu would be done to the French version.
    I'm adding a fix for this based on the MR!10504 from #348. It applies to 10.4.x as well.

    FYI, these were also useful patches if you use these modules:
    Paragraphs:
    "3090200 - #45 Paragraph access check incorrect revision": " https://www.drupal.org/files/issues/2022-10-26/3084934-13_combine_309020... "
    Layout Builder Modal:
    "3133695 - Incompatibility with layout builder": " https://www.drupal.org/files/issues/2022-12-15/3133695-13.patch "

  • First commit to issue fork.
  • Pipeline finished with Failed
    5 months ago
    Total: 171s
    #494903
  • Pipeline finished with Failed
    5 months ago
    Total: 136s
    #494905
  • Pipeline finished with Failed
    5 months ago
    Total: 142s
    #494911
  • Pipeline finished with Failed
    5 months ago
    Total: 145s
    #494919
  • Pipeline finished with Failed
    5 months ago
    Total: 177s
    #494927
  • Pipeline finished with Failed
    5 months ago
    Total: 172s
    #494930
  • Pipeline finished with Failed
    3 months ago
    Total: 153s
    #535400
  • Pipeline finished with Failed
    3 months ago
    Total: 145s
    #535481
  • This patch applies to the latest release to date D11.2.2. See diff here: Compare with previous version
    I've also merged 11.x for the latest 11.x-dev branch so far.

  • @useernamee this patch is for drupal core not for the layout_builder_st module. You should choose either the patch to core or the module, they should both ideally provide symmetrical translations.

  • Pipeline finished with Failed
    18 days ago
    #600545
  • Pipeline finished with Failed
    17 days ago
    #601330
  • Pipeline finished with Running
    17 days ago
    #601342
  • Pipeline finished with Failed
    17 days ago
    #601362
  • Pipeline finished with Running
    17 days ago
    #601527
  • Pipeline finished with Failed
    17 days ago
    Total: 136s
    #601551
  • Pipeline finished with Failed
    17 days ago
    Total: 118s
    #601566
  • Pipeline finished with Failed
    17 days ago
    Total: 441s
    #601570
  • Pipeline finished with Failed
    17 days ago
    Total: 514s
    #601645
  • Pipeline finished with Failed
    17 days ago
    Total: 1109s
    #601664
  • Pipeline finished with Canceled
    17 days ago
    Total: 94s
    #601670
  • Pipeline finished with Failed
    17 days ago
    Total: 723s
    #601671
  • Pipeline finished with Running
    16 days ago
    #602414
  • Pipeline finished with Failed
    16 days ago
    #602431
  • Pipeline finished with Failed
    16 days ago
    #602442
  • Pipeline finished with Failed
    16 days ago
    #602460
  • Pipeline finished with Running
    16 days ago
    #602494
  • Pipeline finished with Failed
    15 days ago
    Total: 110s
    #603518
  • Pipeline finished with Failed
    15 days ago
    #603521
  • Pipeline finished with Failed
    15 days ago
    #603529
  • Pipeline finished with Failed
    15 days ago
    Total: 626s
    #603540
  • Pipeline finished with Failed
    15 days ago
    Total: 771s
    #603574
  • Pipeline finished with Failed
    15 days ago
    #603601
Production build 0.71.5 2024