Kraftvaerk.Umbraco.Blockfilter 1.1.3

dotnet add package Kraftvaerk.Umbraco.Blockfilter --version 1.1.3
                    
NuGet\Install-Package Kraftvaerk.Umbraco.Blockfilter -Version 1.1.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kraftvaerk.Umbraco.Blockfilter" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kraftvaerk.Umbraco.Blockfilter" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Kraftvaerk.Umbraco.Blockfilter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kraftvaerk.Umbraco.Blockfilter --version 1.1.3
                    
#r "nuget: Kraftvaerk.Umbraco.Blockfilter, 1.1.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kraftvaerk.Umbraco.Blockfilter@1.1.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kraftvaerk.Umbraco.Blockfilter&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=Kraftvaerk.Umbraco.Blockfilter&version=1.1.3
                    
Install as a Cake Tool

Block Filter (by Kraftvaerk)

Block Filter is a simple package that replaces the Block Catalogue Modal in Umbraco with one under our control.

Whenever the modal is opened, a RemodelBlockCatalogueNotification is sent, allowing you to modify the block catalogue before it is displayed.

Ever wished a block could only be available to certain users or user groups? Only on certain pages? Only if the editor alias is gridContent? Or maybe only if the logged-in user’s first name is Unicorn?

With Block Filter – and its RemodelBlockCatalogueNotification handler – the sky’s the limit for deciding who gets to see what… and when.


🏷️ Version support

Block filter is compatible with Umbraco 16.0 and later versions.


🚀 Installation

You can install Block Filter via NuGet:

dotnet add package Kraftvaerk.Umbraco.BlockFilter

🛠️ Usage

To use Block Filter, create a handler for the RemodelBlockCatalogueNotification.
This handler lets you modify the block catalogue based on your custom logic.

public class YourNotificationHandler : INotificationAsyncHandler<RemodelBlockCatalogueNotification>
{
    public YourNotificationHandler()
    {
    }

    public async Task HandleAsync(RemodelBlockCatalogueNotification notification, CancellationToken cancellationToken)
    {
        // These are only allowed if the user is an admin
        var adminAliases = new List<string> { "mySecretBlock" };

        if (!notification.Model.User.Groups.Any(g => g.Name == "Administrators"))
        {
            notification.Model.Blocks = notification.Model.Blocks
                .Where(b => !adminAliases.Contains(b.Alias))
                .ToList();
        }

        // "codeBlock" not allowed on the homepage
        if (notification.Model.ContentTypeAlias == "home")
        {
            notification.Model.Blocks = notification.Model.Blocks
                .Where(b => b.Alias != "codeBlock")
                .ToList();
        }
    }
}

public class YourComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.AddNotificationAsyncHandler<RemodelBlockCatalogueNotification, YourNotificationHandler>();
    }
}

📦 License & Contributing

This package is open source and licensed under the MIT License.

Contributions are welcome!
If you find a bug, want to improve something, or have an idea for a feature, feel free to open an issue or submit a pull request.

— Kaspar

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.3 30 9/15/2025
1.1.2 219 8/27/2025
1.1.1 138 8/20/2025