WiredViews.Xperience.PageBuilderModeTagHelper 2.0.0

This package provides an ASP.NET Core Tag Helper to help toggle the rendering of markup in a Razor View based on the Kentico Xperience Page Builder mode of the current request.

Install-Package WiredViews.Xperience.PageBuilderModeTagHelper -Version 2.0.0
dotnet add package WiredViews.Xperience.PageBuilderModeTagHelper --version 2.0.0
<PackageReference Include="WiredViews.Xperience.PageBuilderModeTagHelper" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WiredViews.Xperience.PageBuilderModeTagHelper --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WiredViews.Xperience.PageBuilderModeTagHelper, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install WiredViews.Xperience.PageBuilderModeTagHelper as a Cake Addin
#addin nuget:?package=WiredViews.Xperience.PageBuilderModeTagHelper&version=2.0.0

// Install WiredViews.Xperience.PageBuilderModeTagHelper as a Cake Tool
#tool nuget:?package=WiredViews.Xperience.PageBuilderModeTagHelper&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Xperience Page Builder Mode Tag Helper

NuGet Package

This library provides an ASP.NET Core Tag Helper for Kentico Xperience 13.0 that adds to the existing set.

Dependencies

This package is compatible with ASP.NET Core 3.1 → ASP.NET Core 5 and is designed to be used with the Xperience 13.0 Content Delivery (MVC) application running on ASP.NET Core.

How to Use?

  1. First, install the NuGet package in your ASP.NET Core project

    dotnet add package WiredViews.Xperience.PageBuilderModeTagHelper
    
  2. Add the required types to the DI container in your Startup.cs file

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddSingleton<IPageBuilderContext, XperiencePageBuilderContext>();
    }
    
  3. Include the tag builder namespace in the ~/Views/_ViewImports.cshtml

    @addTagHelper *, Xperience.PageBuilderModeTagHelper
    
  4. Use the tag helper in your Razor views

    <page-builder-mode exclude="Live">
    
        <h1>Hello!</h1>
    </page-builder-mode>
    
    <page-builder-mode include="LivePreview, Edit">
    
        <h1>Hello!</h1>
    </page-builder-mode>
    
  5. You can also use the IPageBuilderContext as a constructor dependency elsewhere in your application to more easily determine the state of the current request, without having to use IHttpContextAccessor and all the Kentico Xperience extension methods:

    public class ProductsController
    {
        private readonly IPageBuilderContext context;
    
        public ProductsController(IPageBuilderContext context)
        {
            this.context = context ?? throw new ArgumentNullException(nameof(context));
        }
    
        public ActionResult Index()
        {
            if (context.IsEditMode)
            {
                // ...
            }
    
            if (context.IsLivePreviewMode)
            {
                // ...
            }
    
            if (context.IsLiveMode)
            {
                // ...
            }
    
            if (context.IsPreviewMode)
            {
                // ...
            }
        }
    }
    

References

ASP.NET Core

Kentico Xperience

Xperience Page Builder Mode Tag Helper

NuGet Package

This library provides an ASP.NET Core Tag Helper for Kentico Xperience 13.0 that adds to the existing set.

Dependencies

This package is compatible with ASP.NET Core 3.1 → ASP.NET Core 5 and is designed to be used with the Xperience 13.0 Content Delivery (MVC) application running on ASP.NET Core.

How to Use?

  1. First, install the NuGet package in your ASP.NET Core project

    dotnet add package WiredViews.Xperience.PageBuilderModeTagHelper
    
  2. Add the required types to the DI container in your Startup.cs file

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddSingleton<IPageBuilderContext, XperiencePageBuilderContext>();
    }
    
  3. Include the tag builder namespace in the ~/Views/_ViewImports.cshtml

    @addTagHelper *, Xperience.PageBuilderModeTagHelper
    
  4. Use the tag helper in your Razor views

    <page-builder-mode exclude="Live">
    
        <h1>Hello!</h1>
    </page-builder-mode>
    
    <page-builder-mode include="LivePreview, Edit">
    
        <h1>Hello!</h1>
    </page-builder-mode>
    
  5. You can also use the IPageBuilderContext as a constructor dependency elsewhere in your application to more easily determine the state of the current request, without having to use IHttpContextAccessor and all the Kentico Xperience extension methods:

    public class ProductsController
    {
        private readonly IPageBuilderContext context;
    
        public ProductsController(IPageBuilderContext context)
        {
            this.context = context ?? throw new ArgumentNullException(nameof(context));
        }
    
        public ActionResult Index()
        {
            if (context.IsEditMode)
            {
                // ...
            }
    
            if (context.IsLivePreviewMode)
            {
                // ...
            }
    
            if (context.IsLiveMode)
            {
                // ...
            }
    
            if (context.IsPreviewMode)
            {
                // ...
            }
        }
    }
    

References

ASP.NET Core

Kentico Xperience

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.0 1,138 12/11/2020
1.0.0 146 12/11/2020