- Issue created by @kyleleber
- πΊπΈUnited States FrankieD3
I've stumbled upon this issue and figured I'd toss in the solution I used for core cases. The issue stems from core, but Gin Layout Builder β makes it a bit easier to notice.
Simply put, the method for determining if the preview is empty sees it as nonempty. The contextual editing link is still present, but in your case, Gin Layout Builder has not reserved space for it.
See #3239899 π Blocks do not have placeholders in Layout Builder Needs work for an explanation as to what's going on, and follow #953034 π± [meta] Themes improperly check renderable arrays when determining visibility Needs work for the main issue.
My solution was to add a library to my front-end theme that I would only enqueue on Layout Builder pages with Gin Layout Builder overrides. See below.
The CSS included in the library:
.layout-builder-block { min-height: 48px; }
Including the library:
/** * Implements hook_page_attachments_alter(). */ function your_theme_page_attachments_alter(array &$attachments) { $is_layout_builder_active = \Drupal::routeMatch()->getRouteObject()->getOption('_layout_builder'); $is_gin_lb_enabled = \Drupal::moduleHandler()->moduleExists('gin_lb'); if ($is_layout_builder_active && $is_gin_lb_enabled) { $attachments['#attached']['library'][] = 'your_theme/gin-layout-builder-overrides'; } }