Skip to content

Commit c05607d

Browse files
authored
Merge pull request #6977 from umbraco/cms/complete-dynamic-root-query-step-example
Update the dynamic root custom query step example
2 parents a0cc631 + 32db39b commit c05607d

File tree

1 file changed

+30
-2
lines changed
  • 15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors

1 file changed

+30
-2
lines changed

15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/content-picker.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ public class MyCustomDynamicRootQueryStep : IDynamicRootQueryStep
100100
_myCustomRepository = myCustomRepository;
101101
}
102102

103+
// The string below is what you specify in the UI to execute this custom query step.
104+
public virtual string SupportedDirectionAlias { get; set; } = "MyCustomStep";
105+
103106
public async Task<Attempt<ICollection<Guid>>> ExecuteAsync(ICollection<Guid> origins, DynamicRootQueryStep filter)
104107
{
105-
// The string below is what you specify in the UI to execute this custom query step.
106-
if (filter.Alias != "MyCustom")
108+
if (filter.Alias != SupportedDirectionAlias)
107109
{
108110
return Attempt<ICollection<Guid>>.Fail();
109111
}
@@ -133,6 +135,32 @@ public class CustomQueryStepComposer : IComposer
133135
}
134136
```
135137

138+
Finally, register the custom query step on the client side and provide a brief description.
139+
140+
You can do this in an `umbraco-package.json` file, as shown below:
141+
142+
```json
143+
{
144+
"$schema": "../../umbraco-package-schema.json",
145+
"name": "My.Test.Extension",
146+
"version": "0.1.0",
147+
"extensions": [
148+
{
149+
"type": "dynamicRootQueryStep",
150+
"alias": "Umb.DynamicRootQueryStep.MyCustomStep",
151+
"name": "Dynamic Root Query Step: My Custom Step",
152+
"meta": {
153+
"queryStepAlias": "MyCustomStep",
154+
"label": "My Custom Step",
155+
"description": "My custom step description.",
156+
"icon": "icon-coffee"
157+
},
158+
"weight": 0
159+
}
160+
]
161+
}
162+
```
163+
136164
### Allow items of type
137165

138166
Choose which types of content should be available to pick using the Content Picker.

0 commit comments

Comments
 (0)