-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dependent fields in collection #565
Comments
You could create a custom widget that provides a select input for selecting type, and the type definitions could be an array of objects defined in the widget config. Then you just swap in fields based on the selected type. |
So I've been considering how this might look. We're now focusing heavily on the extensibility story around the CMS, and a big part of that is making widget authoring simpler, and the available API's more robust. For this particular issue, we should have a widget as I mentioned in my last comment, but I want it to just be a button with configurable text. In the OP case you would configure the label to "Add content", and it's appearance would simply be that of a dropdown, which editors can use to add one of the widgets configured in the "fields" array. The UI around this could be further enhanced by passing control of labels (optionally) to widget authors (currently all widgets automatically receive a label in the UI direct through the CMS). This means an entry could consist of nothing more than this widget and be entirely dynamic, very similar to what ACF provides to WordPress users. Furthermore, if the added widgets are themselves draggable, we'd have all that's needed for site building. Doing all of this in a widget is pretty compelling. Thoughts? |
@erquhart thanks for reminding me about this, I have been meaning to get it finished. Anyhow, I did manage to find a solution to an extent, I could only get preview to work through a custom preview layout. Anyhow, here are some snippets that I generated: config.yml
Control
Hope that helps kick start this conversation ;) |
@domtalbot can you open a "WIP" PR with a working implementation? |
Hi Shawn,
I should be able to do this over the christmas period yes, will keep this
thread updated :)
…On 19 December 2017 at 21:48, Shawn Erquhart ***@***.***> wrote:
@domtalbot <https://github.com/domtalbot> can you open a "WIP" PR with a
working implementation?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#565 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AG11467bYwSm0kzYwWEBDGURYYZlLx5Lks5tCC9LgaJpZM4PGGOv>
.
--
Kind Regards
Dominic Talbot
07791193905
|
Started another issue similar to this. Wondering if you got anywhere @domtalbot and if you need any help? #1066 |
While considering #2405 I think I found a way to statically configure conditional fields right in the yaml while still providing flexibility. Using the original case from @kevinfoerster's OP: - label: structure
name: structure
widget: list
fields:
- label: type
name: type
widget: select
options:
- copy
- divider
- image
- infographic
- productCircle
- quote
- label: content
name: content
widget: object
fields:
- label: text
name: text
widget: markdown
condition: {type: fieldValue, field: type, oneOf: [copy, productCircle, quote]}
- label: src
name: src
widget: image
condition: {type: fieldValue, field: type, oneOf: [image, infographic, productCircle]}
- label: overlay
name: overlay
widget: image
condition: {type: fieldValue, field: type, equals: infographic}
|
I love this idea of the |
Not yet, just a concept for now. Sent with GitHawk |
Looks great already @erquhart. Maybe add |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Any updates on this? I want to display a datetime widget only if a boolean widget is false. |
Hi @caseykey, we're working our way through the most upvoted issues first, so best way to push something forward is to upvote it. |
Like give it a thumbs up? |
Exactly |
@erezrokah Where is this on the roadmap? Would be great to get this feature added! I've got a situation that looks like this: It's very confusing for content editors and hinders their productivity and the potential flexibility of NetlifyCMS. Thanks to all for your hard work on this project ! Kyle |
Hi @kylekirkby, see my comment #565 (comment) and the most upvoted features here https://github.com/netlify/netlify-cms/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc. |
I managed to get it working as a custom widget for my client site so is
perfectly doable. I don't have access to the code anymore though :(
…On Mon, 11 May 2020, 11:29 Erez Rokah, ***@***.***> wrote:
Hi @kylekirkby <https://github.com/kylekirkby>, see my comment #565
(comment)
<#565 (comment)>
and the most upvoted features here
https://github.com/netlify/netlify-cms/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
.
I think one could implement this in a custom widget, and if that works
well we can import it into the main repo.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#565 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWXLY65G5PJCLFOZAPCOHLRQ7HQPANCNFSM4DYYMOXQ>
.
|
Hi guys, I would love to see this feature added too. I have a requirement for a page builder. The way I would like it to work would be that you create a new page based on the following in your config.yml:
The relevant fields for each type of Layout would be rendered out in the editor panel depending on which dropdown option you selected. Although, I'm not sure how I would associate each dropdown value with a unique set of fields (is this where the beta Variable Types widget comes in to play?) When I publish the page, the page's markdown would just include the frontmatter fields that correspond to the selected layout template (e.g a columns field) that was selected during page creation - all pre-populated of course:
|
Hi, any updates on this? |
Hi, I need this feature for a client requirement, how is going on? |
Hi @filipburian and @miguelt1, we have some in progress work in #3891 if you'd like to pick it up. |
6 years and multiple solutions proposed and still nothing🥲 |
In my case, I just needed a boolean widget that is attached to a list widget, and boolean widget can show/hide the list.
and the config would be the same as the one you use for list:
|
hey,
i could not find any information about this therefor i thought i would ask here.
is it possible to show and hide fields depending on some other field?
eg. this is my frontmatter
based on that type different configurations for this list item might be needed
eg.
if my type is
image
only aimage
field is necessary but if the type isinfographic
and additional overlayimage
can be addedmy
config.yml
looks like thisthis list has a lot of unused options and i am far from done adding all the fields
what would a good way to implement this kind of structure?
cms version 0.4.6
The text was updated successfully, but these errors were encountered: