For layout builder to properly allow drag/drop, you need to be printing region_attributes per region, in all of the Bootstrap layout templates, it instead is printing the region itself with it's own attributes.
Instead of using regions as their own variables like:
{% if right.content %}
<{{ right.wrapper }}{{ right.attributes }}>
{{ right.content }}
</{{ right.wrapper }}>
{% endif %}
It should instead append the right attributes to the region_attributes.right, and then print like this:
{% if content.right %}
<div {{ region_attributes.right }}>
{{ content.right }}
</div>
{% endif %}
Comments
Comment #2
b_sharpe commentedPatch merges the attributes with the region attributes, not sure of why it needs to be separate like this, but this seems like the least invasive way to get these attributes into the variables.
Comment #3
chertzogWorks for me +1 RTBC
Comment #4
markhalliwellNestedArray::mergeDeephas, historically, never worked very well when applied to a whole attributes array. It can cause duplicate classes.I'm almost tempted to say maybe
_bootstrap_layouts_parse_attributesshould take another argument so$variables['region_attributes']can be handled by it as well.Comment #5
asterovim commentedThe patch 3018633-draggable.patch works for me. thanks you.
Comment #6
justin2pin commentedThis worked great for me with one small issue: in cases where region attributes don't exist for a specific region, errors are thrown. Attached patch checks to make sure attributes actually exist.
Comment #7
markhalliwellSee #4.
Comment #8
b_sharpe commented@markcarver Can you comment on the original post?
I want to move this forward, and the patch was made to be non-invasive to any other functionality as I didn't have a lot of time to dig in, but wondering why we need something like `<{{ right.wrapper }}{{ right.attributes }}>` and `{{ right.content }}` in the first place?
It seems as if there was specific effort to NOT use the standard:
I'm happy to contribute, but want to stray away from core as little as possible
Comment #9
dariogcode commented#6 works for me.
Comment #10
philyPatch #6 seems to be working fine with Drupal 8.7.8 and Bootstrap Layouts 8.x-5.1
Thanks
Comment #11
shane birley commented@PhilY, did you do anything special outside of applying the patch? I am testing this module and the interface is still blowing apart.
Comment #12
rajab natshah#6 is working without any change to old TWIG files. or any overridden Twig templates in custom themes.
Thank you :)
Looking forward for a better fix as listed in #3
Comment #13
rajab natshahComment #14
dubs commented+1 - works for me. Thanks for investigating and providing a patch :-)
Comment #15
rajendar reddy commented#6 works for me.
Comment #16
komlenic commented+1 Patch in #6 is confirmed working for me also.
Comment #17
rajab natshahComment #18
johanf commentedPatch #6 works like a charm ( drupal 8.9.2, bootstrap_layouts 5.2, with both theme bootstrap4 2.0 and radix 4.8 )
Comment #19
alexmoreno commentedthis is still breaking for me in Drupal 9
Comment #20
b_sharpe commented@alexmoreno I'd switch to https://www.drupal.org/project/bootstrap_layout_builder for D9 if you have the option, far better support/options
Comment #21
alexmoreno commentedoh, great Bryan, I'll give it a go
Comment #22
alexmoreno commentedactually this was not the issue, but some html tags that were breaking javascript with this message.
Uncaught TypeError: Cannot read property 'permissionsHash' of undefined(anonymous functionSee https://www.drupal.org/project/drupal/issues/2780777#comment-14258750
Comment #23
joseph.olstadThere is a workaround to the incompatibility issue with layout_builder, install this module:
https://www.drupal.org/project/layout_builder_admin_theme
Comment #25
rajab natshahCommitted ... Thank you.
Comment #26
rajab natshah✅ Released bootstrap_layouts-8.x-5.3