XperienceCommunity.PageCustomDataControlExtender 1.0.0

dotnet add package XperienceCommunity.PageCustomDataControlExtender --version 1.0.0
NuGet\Install-Package XperienceCommunity.PageCustomDataControlExtender -Version 1.0.0
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="XperienceCommunity.PageCustomDataControlExtender" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XperienceCommunity.PageCustomDataControlExtender --version 1.0.0
#r "nuget: XperienceCommunity.PageCustomDataControlExtender, 1.0.0"
#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.
// Install XperienceCommunity.PageCustomDataControlExtender as a Cake Addin
#addin nuget:?package=XperienceCommunity.PageCustomDataControlExtender&version=1.0.0

// Install XperienceCommunity.PageCustomDataControlExtender as a Cake Tool
#tool nuget:?package=XperienceCommunity.PageCustomDataControlExtender&version=1.0.0

Xperience Page Custom Data Control Extender

A Kentico Xperience Form Control Extender that sync the Form Control value to/from Page CustomData fields

Dependencies

This package is compatible with Kentico Xperience 13.

How to Use?

  1. First, install the NuGet package in your Kentico Xperience administration CMSApp project

    dotnet add package XperienceCommunity.PageCustomDataControlExtender
    

See project README for full instructions

How Does It Work?

Normally, if we want to store data in Pages, we define fields for the Page's custom Page Type. This field often a "Standard Field" which results in a column in the Page Type field database table.

However, Pages already have 2 fields that can be used to store any kind of serializable data/content - DocumentCustomData and NodeCustomData. Data in these fields is store in XML data structures and the TreeNode APIs to access these fields perform the XML serialization/deserialization automatically.

If we want to store data in these fields we need a way to associate a Form Control (eg Check Box, Text Box, Media Selector) with a one of these XML structures and an XML element name in which the value of the Form Control should be stored.

Kentico Xperience's Portal Engine API (still used in the Administration application) allows for Form Control Extender classes to get access to a Form Control's data, Page, and Form during events of the Control's event lifecycle.

This NuGet package exposes a Form Control Extender that can be applied to custom Form Controls that inherit from existing ones - maintaining their original functionality, but intercepting the Value produced by the Form Control and sync it to/from the Page's CustomData field.

Since the Page Type field that the extended Form Control operates on is a "Field without database representation", the Page Type database table does not need modified and Content Managers don't lose any of the standard content management functionality they are used to.

Querying XML via SQL

Normally Page CustomData fields should to be used to store data that we want access to when we retrieve a Page from the database, in which case the DocumentCustomData or NodeCustomData will handle the XML deserialization for you.

However, if we want to filter in SQL on these XML columns, we can cast the column to the SQL XML type and filter on its value.

Using the setup in the steps above, this query would return all Pages (of any Page Type) that have "Show In Sitemap" set to true.

SELECT *
FROM CMS_Document
WHERE CAST(DocumentCustomData as XML).value('(//CustomData/ShowInSitemap/text())[1]', 'bit') = 1

References

Kentico Xperience

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 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.0.0 13,756 9/21/2021
1.0.0-beta-2 194 9/14/2021
1.0.0-beta-1 173 9/14/2021