webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

Add a "Dynamic Field" on the Content Model builder (Headless CMS).

Open ademoverflow opened this issue 3 years ago • 11 comments

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

Not a problem, just a new feature 🎉

Describe the solution you'd like.

I started to use Webiny for my projects because it supports serverless deployment on AWS (but not only for that).

I would like to use the headless API part of webiny as a page content manager, and thus I need a field that can hold a list of different fields (not predefined fields ofcourse, that's why it is called dynamic).

Describe alternatives you've considered.

I was wondering if I can manage to use plugins to write my own custom field that suits my needs, or maybe there will be a support for that feature soon ?

ademoverflow avatar Jun 11 '22 18:06 ademoverflow

Hey @adem-usta, thanks for raising this request. We will have a feature coming soon where you'll be able to do something like that. In the meantime, if it's urgent for you, you can build a custom field type for your project that adds such support using this guide here: https://www.webiny.com/docs/headless-cms/extending/custom-field-type

SvenAlHamad avatar Jun 11 '22 19:06 SvenAlHamad

Hey @SvenAlHamad , thank you for your fast answer ! Yes, I saw this part of the documentation, I will dig it.

Has webiny got a public roadmap for its new coming features ? That would be great !

ademoverflow avatar Jun 11 '22 20:06 ademoverflow

We’re a bit behind in updating our public roadmap at the moment, but I hope we’ll have something online in the next few weeks. In the meantime if you do have any roadmap questions, just ping us on our community slack.

SvenAlHamad avatar Jun 11 '22 21:06 SvenAlHamad

@adem-usta Do you have a more concrete example of what you're looking for? Maybe another CMS that has that feature or maybe just a UI sketch? I'd like to understand your requirement a bit better.

The issue with dynamic fields is that they need to generate a proper GraphQL schema, which is challenging if every entry can have entirely different fields. Unless you make a container field, and make it of type JSON.

So if you can provide more insight, we could exchange ideas and probably come up with something.

Pavel910 avatar Jun 12 '22 11:06 Pavel910

The idea is pretty simple:

Imagine that you want to manage a website pages with Webiny (without using the Page Builder).

You'll create a "Page" Content model, with some basic info:

  • title (str)
  • path (str)
  • icon (whatever the type) etc ...
  • AND a 'content' field which is supposed to store all the page contents (header, sliders, cards, etc ...) By the nature of this field, we cannot define a strong typed data structure for this field.

I think it could be a list of references, or a list of generic objects.

There is a similar feature on strapiJS, which is called DynamicField (yeah, I'm not so creative haha). A link to illustrate: https://strapi.io/blog/release-beta-18-dynamic-zones

After digging a little, I think that the same thing could be achieved with Object + References in Webiny, but with less freedom ?

And to finish, maybe what I want is possible to do with the Page Builder ? Then, my question is:

  • am I able to fetch pages data from the GraphQL API ? Basically my frontend is built with GatsbyJS and the goal is to manage pages with Webiny.

Thank you for your time @Pavel910 !

ademoverflow avatar Jun 12 '22 12:06 ademoverflow

Thanks for all the details @adem-usta, this really helps setting the stage.

Dynamic Zone is something we do plan to add, we actually built a PoC for that, and I think our implementation will even have more flexibility. Judging by your description and the link you shared, our approach should be a good fit for your problem, but it's not yet ready for release.

To answer your second question, yes, Page Builder can be queried via GraphQL, that's actually the only way to get page data, and you get back JSON which you can then render yourself. Check out the code in your Webiny project, in apps/website/code/src/components/Page.

Pavel910 avatar Jun 12 '22 13:06 Pavel910

Thank you for your answer @Pavel910

Great to read that ! Any idea on when do you plan to release this feature ?

ademoverflow avatar Jun 12 '22 14:06 ademoverflow

@adem-usta we'll be working on proper implementation in Q3. Can't give you any better estimates for now, unfortunately.

Please let us know which way you proceed, and we'd really appreciate if you could share some visuals/videos of whatever you come up with.

Pavel910 avatar Jun 12 '22 19:06 Pavel910

Thank you for your answer @Pavel910 Great news ! Waiting for this key new feature 🔥

Please let us know which way you proceed, and we'd really appreciate if you could share some visuals/videos of whatever you come up with.

Yes completely, I am currently working on a viable solution. Once I am satisfied with it, I'll share my temporary solution here.

ademoverflow avatar Jun 17 '22 10:06 ademoverflow

Hi @Pavel910, any update on this feature ?

ademoverflow avatar Sep 21 '22 12:09 ademoverflow

@adem-usta this is being worked on, but it will be more than just a new field. We've developed an entire new concept of "Headless Pages" which is specifically targeted at managing pages in a headless manner. More on this very soon :)

Pavel910 avatar Sep 21 '22 19:09 Pavel910

Great to read that ! Can't wait to test it 🔥

ademoverflow avatar Sep 23 '22 16:09 ademoverflow

Hi @Pavel910 ,

Do you have an update on this matter? Out of necessity I created a custom post field just for this, but it has much less flexibility.

Do you have an example of the solution and an ETA?

robin-vinck avatar Oct 21 '22 17:10 robin-vinck

Hey @Pavel910 , I'm back 4 months later to check what's up with this feature ? Is this still on your roadmap ?

Thanks in advance :)

ademoverflow avatar Jan 09 '23 15:01 ademoverflow

@ademoverflow @robin-vinck this is landing in the next release, 5.34., we're wrapping up the release preparations as we speak :)

Pavel910 avatar Jan 09 '23 16:01 Pavel910

What a good news ! Can't wait 🔥

ademoverflow avatar Jan 09 '23 16:01 ademoverflow