elegantthemes / Divi-Beta

8 stars 0 forks source link

How to render Divi Library in Divi 5? #63

Open Lovely-Fellow opened 5 months ago

Lovely-Fellow commented 5 months ago

Is your feature request related to a problem? Please describe.

I need to render Divi Library in Divi 5. We were using do_shortcode in Divi 4.

do_shortcodes("[et_pb_section global_module='123456'][/et_pb_section]");

Describe the solution you'd like

I want to get HTML & Styling of Divi library by post id.

echo do_blocks("<!-- wp:divi/global-layout {'globalModule':'123456'} /-->");

Currently above code is getting empty. Theme Version: Version: 5.0.0-dev-beta.17

Discord: https://discord.com/channels/1041765492907589683/1083948755885244446/1234569738768613408

xxtesaxx commented 1 week ago

We heavily depend on this functionality to migrate our plugin to Divi 5 (Carousel module, Advanced Tabs module, Content Slider module, Content Toggle module). We need to be able to load any layout by providing the post id in VB as well as on the frontend.

It should be possible to nest layouts infinitly, even if it might increase loading time. It should be the users responsibility to not nest too many layouts but we must not be limited to one or two layers.

lets say we have a library layout with some modules (level 0), which we include in a custom module which is stored on a custom post type. This layout then should also be possible to include in a custom module inside a blog post.

As an example, lets imagine a module with exactly 1 field and no other settings, a text field where you enter a post id. This module would render whatever post this is (post, page, library layout, product, project or any other CPT). I should be able to create 10 layouts each referencing each other like "Post with Layout module > Library Layout with Layout module > Library Layout with Layout module > Library Layout with Layout module > Library Layout with Layout module > Library Layout with Divi Text module".

Yes, this brings up the possibility of having an infinite loops by building circular layouts (Layout module 1 > Layout module 2 > Layout module 1) but this should be the users responsibility. At least if its not possible to automatically detect those circular layouts.

We need a proper API to do this and ideally a short tutorial/docs and/or a demo module showing how to use the API.

divilover commented 1 week ago

We also need this functionality, and detailed documentation on how to achieve it (even for single-level nesting) would be very helpful. Thanks!