- Issue created by @flyke
- Merge request !68add library on canonical route if layout_builder_ipe is enabled → (Open) created by flyke
I recently stumbled upon the layout_builder_ipe module, which makes it possible to edit a layout directly on the node/entity page without going to the layout edit route. But when editing a block for example this way, the bootstrap styles are not loaded.
- have a layoutbuilder entity/node type
- add and enable layout_builder_ipe, edit the entity view mode to 'Use the Layout Builder IPE frontend' so it shows an 'Edit' button when displaying the page/node/entity
- visit a layoutbuilder node/entity and click on the 'Edit' button provided by the layout_builder_ipe module
- edit a block or section just like you would on the layout edit page
- notice styling problems because bootstrap styles is not loaded
edit bootstrap_styles/bootstrap_styles.module
and alter the bootstrap_styles_page_attachments_alter
function: add module_handler service and check if the layout_builder_ipe module is enabled. If so, add the entity canonical route to $layout_routes:
$settings = \Drupal::config('bootstrap_styles.settings');
$entity_types = array_keys(\Drupal::entityTypeManager()->getDefinitions());
$layout_routes = [];
$moduleHandler = \Drupal::service('module_handler');
foreach ($entity_types as $entity_type_id) {
$layout_routes[] = 'layout_builder.defaults.' . $entity_type_id . '.view';
$layout_routes[] = 'layout_builder.overrides.' . $entity_type_id . '.view';
// layout_library module.
$layout_routes[] = 'layout_builder.layout_library.' . $entity_type_id . '.view';
// Module layout_builder_ipe allows editing from default node route.
if ($moduleHandler->moduleExists('layout_builder_ipe')) {
$layout_routes[] = 'entity.' . $entity_type_id . '.canonical';
}
}
- create MR or patch
- test
- commit
Active
2.0
Code