elegantthemes / create-divi-extension

MIT License
185 stars 59 forks source link

How to use dynamic_content on jsx? #196

Open mrkenng opened 5 years ago

mrkenng commented 5 years ago

Problem Description

How do we use dynamic_content? I see them on the php module files and how do we render them in react? Thanks!

Steps To Reproduce

1.

Screenshot and/or gif

xxtesaxx commented 5 years ago

Apparently the public API for this is not published yet but will be available for us third party devs soon

mrkenng commented 5 years ago

Thanks Jan!

themohdarif commented 5 years ago

Any update on this?

xxtesaxx commented 5 years ago

No, not yet.

jcdotnet commented 5 years ago

@lots0logs coud you update the divi-extension-example with the new Divi features (dynamic content, quick edit using the pencil, hover)? It would be very helpful. Thank you!!!

Paul-S-Taylor commented 5 years ago

I have a client who wants to add dynamic counters and bars - any update on how to do this please

jcdotnet commented 5 years ago

version 3.20.2 ( updated 03-11-2019 )

According to the changelog we can already use it.

Please, keep us updated. As mentioned above, adding this feature to the divi-extension-example would be really helpful.

Paul-S-Taylor commented 5 years ago

Client has now gone elsewhere for web project - thanks for support (not)!

mrkenng commented 5 years ago

Is there any examples ?

achchu93 commented 3 years ago

As i struggled to find the example, I will leave the link here. https://gist.github.com/lots0logs/9b6bb0b3d494f4d0bdf957955d97cb26

Happy Coding!!

arobbins commented 6 months ago

@achchu93 Do you know of another way around this?

The dynamic content value is stored like this: @ET-DC@eyJkeW5hbWljIjp0cnVlLCJjb250ZW50Ijoic2l0ZV90aXRsZSIsInNldHRpbmdzIjp7ImJlZm9yZSI6IiIsImFmdGVyIjoiIn19@.

I even tried base64 decoding and ended up with this:

{"dynamic":true,"content":"site_title","settings":{"before":"","after":""}}

It's like the value is just not passed to the client.

Oddly enough, the dynamic content value is coming through correctly on the PHP side.

achchu93 commented 6 months ago

@arobbins You have 2 ways.

  1. Use the same way how Divi does, Sending Ajax request and getting value as per the screenshot. image

  2. Use your own ajax method and use the et_builder_resolve_dynamic_content method to resolve the data.