Skip to content

Commit bedf286

Browse files
authored
Correct code sample to be compilable
Updated flag provider implementation to include additional using directives and modified the ShouldAddFlag method to be generic.
1 parent 893615f commit bedf286

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

17/umbraco-cms/extending/flag-providers.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ To create a flag provider, implement the `IFlagProvider` interface. There are tw
3939
An illustrative implementation is as follows:
4040

4141
```csharp
42-
using Umbraco.Cms.Api.Management.ViewModels;
4342
using Umbraco.Cms.Core;
43+
using Umbraco.Cms.Api.Management.Services.Flags;
44+
using Umbraco.Cms.Api.Management.ViewModels;
45+
using Umbraco.Cms.Api.Management.ViewModels.Document.Collection;
46+
using Umbraco.Cms.Api.Management.ViewModels.Document.Item;
47+
using Umbraco.Cms.Api.Management.ViewModels.Tree;
4448

4549
internal class MyDocumentFlagProvider : IFlagProvider
4650
{
@@ -67,7 +71,7 @@ internal class MyDocumentFlagProvider : IFlagProvider
6771
return Task.CompletedTask;
6872
}
6973

70-
private bool ShouldAddFlag(TItem item) => return true; // Provide custom logic here.
74+
private bool ShouldAddFlag<TItem>(TItem item) => true; // Provide custom logic here.
7175
}
7276
```
7377

0 commit comments

Comments
 (0)