Pass classes to box wrapper (like spacing is done) #112
-
Hi! Absolutely love this plugin and now trying to create a very flexible builder using UI Kit css. The idea is to nest a row box -> column box -> title, content, other pices... but as every box needs to be wrapped by a div with service boxes classes (oc-*) it's not possible to have: grid (row) div > column div (direct ansector). For frontend BOXES_RENDER_SCAFFOLDING=false helps but then in backend preview it obviously stops working. Is there a way to pass these classes to views/_box template along with spacing classes as box object properties? I hardcoded that in the view and it completely solved my problem, so now the question is how to do that with events or some other way. Please suggest some solution. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
<style>
.oc-box { display: contents; }
</style>
<div class="grid">
<div class="oc-box"> <!-- This will be ignored in the grid -->
<div class="some-grid-item"> As a more general solution, we could add an Event that you could use like so: Event::listen('offline.boxes.extendBoxClasses', function (Box $box) {
if ($box->config->handle === 'some-grid-item') {
return 'your-custom-class';
}
}) Would that solution be suitable for your use-case? |
Beta Was this translation helpful? Give feedback.
-
This feature is now available in v3.5.5, thank you for the input! |
Beta Was this translation helpful? Give feedback.
-
Tobias, thanks a lot!!! |
Beta Was this translation helpful? Give feedback.
-
Have you any idea why classes are 'leaking' into child boxes? This is unwanted behaviour |
Beta Was this translation helpful? Give feedback.
This feature is now available in v3.5.5, thank you for the input!
Docs