elegantthemes / Divi-Beta

8 stars 0 forks source link

defaultParentSettingsAttrs In Child Module #38

Open dtcblyth opened 10 months ago

dtcblyth commented 10 months ago

Related thread: https://discord.com/channels/1041765492907589683/1172157923082907708

Problem:

When using the visibility attribute to conditionally show toggles and fields based on the values from other settings, it is usually neccessary to merge the component’s attrs and defaultSettingsAttrs. Something like this:

const moduleAttrs = mergeAttrs({
  defaultAttrs,
  attrs,
});

However, when working with parent/child modules, this is not so easy. As far as I can see, the child module receives the following attributes: attrs, defaultSettingsAttrs, and parentAttrs. However, there is no defaultParentSettingsAttrs. This means that there is no easy way to conditionally show toggles and fields in a child module based on the values from settings in the parent module.

Solution:

Would it be possible to include the defaultParentSettingsAttrs in the child module component?