property editor status
# help-with-umbraco
s
does anyone know how can I query another property editor I made? so one property editor is dependent on another one. if the one I picked lets say from a select one option so the other custom one gets the state of the first one and display its content accordingly? hope the question is understood. i'm working on umbraco 15
l
Sound more like these two 'parts' should be together in a single property editor? I think you need to explain a bit more what you are trying to do and why.
s
iv'e built one custom property editor that gives a option to select between themes. now according to the theme chosen in another property editor the values of certain colors are suppose to change. so lets say Secondary color changes depending of the theme chosen
l
@sky You can use the
UMB_PROPERTY_DATASET_CONTEXT
to observe the value of another property (within the same dataset). You'll want to do this on the target property-editor, e.g. whatever is going to listen out for the source property-editor value changes.
Copy code
this.consumeContext(UMB_PROPERTY_DATASET_CONTEXT, async (dataset) => {
    this.observe(await dataset.propertyValueByAlias('theme'), (value) => {
        // do something with the `value`
    });
});
Here's an example of how the core's own Color Picker configuration uses it (for the "Show label" field). https://github.com/umbraco/Umbraco-CMS/blob/release-15.1.1/src/Umbraco.Web.UI.Client/src/packages/core/components/multiple-color-picker-input/multiple-color-picker-input.element.ts#L94-L103
l
wow nice! I'm going to start soon with porting a number of our Umbraco 13 packages to 15 and find it all very fascinating 🙂
s
Thanks @leekelleher
2 Views