Closed UmerCheema-WPD closed 2 weeks ago
@UmerCheema-WPD Sorry for the late response.
Actually, you can use visible
property with callback function in your field definition.
Based on your code example, it looks like this:
customColorPicker: {
groupSlug: 'newOptionsGroup',
attrName: 'customColorPicker',
label: 'Custom Field Color',
description: 'This is a test description',
render: true,
priority: 0,
component: {
type: 'field',
name: 'divi/color-picker',
},
visible: ({
attrs,
attrName,
responsiveMode,
stateMode,
}) => {
return 'on' === attrs?.customToggle?.desktop?.value;
},
},
Please check video to see how it works.
https://github.com/user-attachments/assets/6c4979ba-4043-48a4-ab0b-d8e65d305c6b
We also added new tutorial series called Adding Custom Module Settings Via Hook where you can learn how to add custom options group and option field via hook. With this additional documentation update, I'm going to close this issue. Feel free to open new one if you have other questions/requests. Thanks!
I have added a custom field toggle, and now I want to show the second custom field color based on the toggle being on or off. How can I do that?