Layout paragraphs builder detection doesn't work in translation leading to unexpected slick initialization in backend

Created on 29 September 2025, 6 days ago

Problem/Motivation

For the layout paragraphs builder we need to detect, if we're currently in edit or output mode, so that the theme can react on that correctly.

For that reason we have:


/**
 * Implements hook_preprocess_HOOK().
 */
function drowl_paragraphs_bs_type_layout_slideshow_preprocess_layout(&$variables) {
  // Layout Paragraphs module support:
  if (\Drupal::service('module_handler')->moduleExists('layout_paragraphs')) {
    // Ensure each layout_paragraphs builder region is rendered, even if empty:
    // @see https://www.drupal.org/project/drowl_layouts_bs/issues/3294075
    if (!empty($variables['layout'])) {
      $defaultRegion = $variables['layout']->getDefaultRegion();
      $hasDefaultRegion = !empty($defaultRegion);
      $isLayoutParagraphsBuilder = $hasDefaultRegion && !empty($variables['content'][$defaultRegion]['#attached']['drupalSettings']['lpBuilder']);
      if ($isLayoutParagraphsBuilder) {
        // This is a layout paragraphs builder (edit mode).
        // Set a layout twig variable to implicate we need to force rendering
        // empty regions:
        $variables['drowl_paragraphs_is_layout_paragraphs_builder'] = TRUE;
      }
    }
  }

https://git.drupalcode.org/project/drowl_paragraphs_bs/-/blob/1.0.10/mod...

Translating content with a drowl_paragraphs_bs_type_layout_slideshow paragraph, we saw that Slick was wrongly initialized in the backend, so that scrolling was impossible.
drowl_paragraphs_is_layout_paragraphs_builder was FALSE in the translation form, while it was true when editing in the original language.

The reason seems to be that our condition doesn't reliably work for translated content.

The same issue also can be reproduced in drowl_paragraphs:

Steps to reproduce

See above.

Proposed resolution

Check the edit mode independently from language.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

Not all content is available!

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

No activities found.

Production build 0.71.5 2024