- Issue created by @SocialNicheGuru
- πͺπΈSpain Peacog
I am seeing this error too. The javascript error is caused by lines 10 and 11 in gin_lb_preview_regions.js. The expected elements with id #glb-toolbar-preview-regions and #glb-toolbar-preview-content don't exist. The elements don't exist because gin_lb_preprocess_toolbar__gin_lb is never called.
- πΊπΈUnited States jessehs Taos, New Mexico
I encountered this error, along with the symptom that the the "Show content preview" checkbox was missing (in both the sidebar and the toolbar at the top).
The problem was that the parent theme of the frontend theme, Radix, was preprocessing the form element using HOOK_preprocess_form_element, and moving the input/checkbox into the label template. So since gin_lb overrides these two templates, that preprocess was messing up gin_lb's templates.
The solution was to patch the Radix theme to return if the #gin_lb_form element was present:
/** * Implements template_preprocess_form_element(). */ function radix_preprocess_form_element(&$variables) { // Layout-builder related form elements should be left untouched. if (!empty($variables['element']['#gin_lb_form'])) { return; } // Render the form element inside the label for checkbox and radio. if (in_array($variables['element']['#type'], ['checkbox', 'radio'])) { $variables['label']['#children'] = $variables['children']; unset($variables['children']); } }
- π©πͺGermany berliner
There is a simple patch to fix this issue available in β¨ Prevent JS errors when Layout Builder is not initially displayed but loaded later via ajax Fixed
- Status changed to Closed: duplicate
over 1 year ago 7:15am 20 June 2023 - π©πͺGermany Christian.wiedemann
I will mark it as duplicate. Feel free to reopen it if I am wrong.