Property Editor: Content Picker - pick from master root node

Hi

Using “Content Picker”, i want to pick content outside my “root”. A way to do this is creating a custom query step as described in this post (and the doc). The result is really what i need. I just can’t get it to work.:

Code I am testing with is this:

public class MyCustomDynamicRootQueryStep : IDynamicRootQueryStep
{
    public async Task<Attempt<ICollection<Guid>>> ExecuteAsync(ICollection<Guid> origins, DynamicRootQueryStep filter)
    {
        await Task.Yield(); // "ignore" async warning
        
        if (filter.Alias != nameof(MyCustomDynamicRootQueryStep))
        {
            return Attempt<ICollection<Guid>>.Fail();
        }

        if (origins.Any() is false)
        {
            return Attempt<ICollection<Guid>>.Succeed(Array.Empty<Guid>());
        }

        var result = new [] { Guid.Parse("916724A5-173D-4619-B97E-B9DE133DD6F5") }; // SYSTEM DATA: umbraco master root

        return Attempt<ICollection<Guid>>.Succeed(result);
    }

    public string SupportedDirectionAlias { get; } = nameof(MyCustomDynamicRootQueryStep);
}

public class CustomQueryStepComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.DynamicRootSteps().Append<MyCustomDynamicRootQueryStep>();
    }
}

The composer code is hit, but the QueryStep: ExecuteAsync method is not. I would have expected this to happen at some point when I am editing a content picker editor.

What am I doing wrong, or I am expecting the wrong thing?
I am using version 15.3.0

Documentation

@rbrunge I have the exact same problem. I can’t get my custom query step to show up.
Did you find a solution?

To get the custom Dynamic Root query steps to display in the UI, a client-side extension needs to also be registered. See the documentation for an example of this:

The reason for this is that the server knows nothing about the appearance of the query step, e.g. the label, description and icon, So these need to be defined on the client. Admittedly, it may not be ideal to have this type of disconnect between the UI and server, it is something that could be improved on in a future version.

Great. Based on your link, I added a umbraco-package.json file in a folder under App_plugins, and now it works

2 Likes

Thanks Lee - I can also confirm. Totally missed the front end glue.

1 Like