Field is not rendered in multilingual layout_builder

Created on 1 April 2025, about 1 month ago

Problem/Motivation

Using better_social_sharing_buttons as a field it displays in the right place (assigned by the layout_builder) only in the site's default language. On the other languages it displays at the bottom of the node display (after the layout_builder's rendering)

Steps to reproduce

  1. In admin/config/services/better_social_sharing_buttons/config check the "Enable Better Social Sharing Buttons display field for nodes" checkbox
  2. In admin/config/regional/language verify that you have at least two languages enabled (in my case en + fr)
  3. In admin/config/regional/content-language be sure to have a translatable content type
  4. Create a node with some fields, and translate some of them
  5. In admin/structure/types/manage/your_content_type/display check the "Use Layout Builder" option, then save
  6. Then manage the layout (admin/structure/types/manage/songs/display/default/layout) and place the "Better Social Sharing Buttons" field between two other fields (the point here is not to place the buttons at the bottom of layout builder)

- Display the node you created before in the site's default language => Everything should look okay and sharing_buttons are displayed at the right place.
- Verify with a hook_node_view() where you print dpm($build['_layout_builder']). Indeed sharing_buttons are present in something like

"60ec691a-f458-4d4c-9cf8-c3480e7a5140" => array:9 [
"#theme" => "block"
"#configuration" => array:6 [
"id" => "extra_field_block:node:your_content_type:sharing_buttons"
"label" => ""
"label_display" => "0"
"provider" => "layout_builder"
etc.

- Now display the node in the other language => sharing_buttons are still present at the bottom of the display and out of the _layout_builder context.
You can verify this with your browser's inspector. Also, the dpm($build['_layout_builder']) hook_node_view() doesn't have any "sharing_buttons" string although $build['sharing_buttons'] is present.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

4.1

Component

Code

Created by

🇫🇷France erwangel

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

Comments & Activities

Production build 0.71.5 2024