Page Builder Widgets Questions

lawrence whittemore asked on June 4, 2021 14:27

So, I may be confused with the purpose of page builder. In portal mode we would build widgets that users could add to a page to pull in content from different areas of the site (often built off of the repeater web part). This allowed us to place something like a set of sliders in a folder and then the users could reuse those sliders on any page just by adding a widget and pointing it to that folder. Then if they wanted a different set of sliders on page a user could add the same widget and set it to point to the second set of sliders.

Is it still easy to build a widget like this in 13? One Thing I am testing is adding a form field to the widget that would allow the user to set the Path to where the sliders are. In portal mode I would just set the widget to be a repeater type, and turn display for the path field set a transformation and be done.

Hope this makes sense.

Recent Answers


James Phillips answered on June 7, 2021 15:19 (last edited on June 7, 2021 15:21)

We do this by using a page selector widget property:

[EditingComponent(PageSelector.IDENTIFIER, Order = 1, Label = "Path location")]
public IList<PageSelectorItem> ItemsRootFolder { get; set; }

Then in the widget controller get the alias path for the selected node and use a path query as below to get any children:

            var qry = DocumentHelper.GetDocuments()
        .LatestVersion(LatestVersionEnabled)
        .Published(!LatestVersionEnabled)
        .Culture(PageCulture)
        .CombineWithDefaultCulture()
        .Path(aliasPath.ToString(), PathTypeEnum.Children)
        .CheckPermissions(true);

I recommend using repositories within the widget controllers when doing data access

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.