Skip to content

Go through Widget Configurations

Trevor Fayas edited this page Sep 8, 2022 · 2 revisions

After you've ran the Widget Configuration builder (KX12 To 13 Converter -> Page Converter -> 3 - Widget Configuration), here's some things to consider as you comb through it.

Review Widget Usage

Take a look at each widget and see where it's actually used and how much it's used. Use the below SQL script to view what pages are actually using the widget, if only 1 page uses it or a limited # use it, it may be worthwhile to consider if this can be handled differently (hard coded, make a template, or combine with a different widget)

declare @PE_WidgetCodeName nvarchar(100) = 'YoutubeVideo'

-- In Widget Zone
select SiteDisplayName, DocumentNamePath, NodeAliasPath, DocumentCulture from View_CMS_Tree_Joined
inner join CMS_Site on SiteID = NodeSiteID
where DocumentWebParts like '%"'+@PE_WidgetCodeName+'"%'
order by NodeSiteID, DocumentNamePath

-- Inline
select SiteDisplayName, DocumentNamePath, NodeAliasPath, DocumentCulture, DocumentContent from View_CMS_Tree_Joined
inner join CMS_Site on SiteID = NodeSiteID
where DocumentContent like '%(name)'+@PE_WidgetCodeName+'%'
order by NodeSiteID, DocumentNamePath

Remember, you can set the PB_WidgetIdentifier to "IGNORE" if you want these widgets to not be processed.

Changing Code Names

Now is a great time to adjust your Widget Identities, you can set the "PB_WidgetIdentifier" from INHERIT to whatever you want it to be. You can also change the OutKeys to a new field name.

Post Processing Adjustments

In many cases widgets had configurations that returned data such as transformation names, columns, or orders, which of course won't work in KX13. Many of these values may need to be adjusted to new values. Use the PortalToMVCEvents.ProcessWidget.After global event hook to make adjustments, below is such an example:

        // Convert the transformation name to a property to toggle the visible
        if (e.PageBuilderWidget.TypeIdentifier.Equals("Custom.FaqsListing", StringComparison.OrdinalIgnoreCase))
        {
            var pageBuilderItem = e.PageBuilderWidget.Variants.First();
            if (!pageBuilderItem.Properties.ContainsKey("ToggleVisible"))
            {
                pageBuilderItem.Properties.Add("ToggleVisible", "false");
            }
            else
            {
                switch (pageBuilderItem.Properties["ToggleVisible"].ToLower())
                {
                    case "cms.faq.FAQWithHiddenDisplay":
                        pageBuilderItem.Properties["ToggleVisible"] = "true";
                        break;
                    default:
                        pageBuilderItem.Properties["ToggleVisible"] = "false";
                        break;
                }
            }
        }

Take Notes

I recommend making a note of each widget you are converting, and what widgets you are not converting and why. This can help you both as you build out the widgets in KX13.

Clone this wiki locally