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