Oct 5, 2011
  4800
(3 votes)

FilteredPageReference v1.4 Released

For those of you who are interested but not aware the FilteredPageReference assembly provides a developer with two new properties that are essentially a replacement for the PageReference and LinkItemCollection properties.  These properties allow a developer to restrict what types of pages can be picked and define a page picking start page as well as a few other options.  These settings can be set either through property settings in admin mode or programmatically at runtime.

For more information and links back to previous blog posts see here.

New Features in v1.4

  • The previous version did not work correctly with EPiServer Commerce.  This was because the various handlers used for commerce intercept most .aspx requests and were bypassing my custom VPP handler for embedded resources.  This has been fixed in this version.
  • Pages in the tree that come from custom page providers can now be set as start pages.
  • FilteredPageReference uses a bit of reflection against PageTypeBuilder if you are using it in your project.  This reflective code has now been optimized.
  • In previous versions you could programmatically set the start page based on property information.  This version allows you to also set the allowed page types programmatically.

Installation

Previous versions were built for CMS 6 and onwards.  v1.4 is built specifically against CMS 6 R2 to make use of the new auto mapping DDS functionality for the property settings that are used.

The easiest way to install the assembly is to get it from the EPiServer nuget feed or you can download it from codeplex.

Examples

Below is an example of how you can override the configured start page in code:

  1: public class Global : EPiServer.Global
  2: {
  3:     protected void Application_Start(Object sender, EventArgs e)
  4:     {
  5:         FilteredPageReference.PropertyFilteredPageReferenceSettings.GetPagePickingStartPage = GetPagePickingStartPage;
  6:     }
  7: 
  8:     private void GetPagePickingStartPage(FilteredPageReference.PagePickingStartPage pagePickingStartPage)
  9:     {
 10:         // below are properties available to interigate to determine the start page
 11:         string languageId = pagePickingStartPage.PropertyInformation.LanguageId;
 12:         string pageId = pagePickingStartPage.PropertyInformation.PageId;
 13:         int pageTypeId = pagePickingStartPage.PropertyInformation.PageTypeId;
 14:         string parentPageId = pagePickingStartPage.PropertyInformation.ParentPageId;
 15:         string propertyName = pagePickingStartPage.PropertyInformation.PropertyName;
 16:         int workId = pagePickingStartPage.PropertyInformation.WorkId;
 17: 
 18:         // set the start page, or leave it unset if no override is required
 19:         if (pageTypeId == PageTypeResolver.Instance.GetPageTypeID(typeof(PageTypeOne)).Value &&
 20:             string.Equals(propertyName, new PageTypeOne().GetPropertyName(p => p.PropertyOne)))
 21:         {
 22:             pagePickingStartPage.StartPage = DataFactory.Instance.GetChildren(PageReference.StartPage)[5].PageLink;
 23:         }
 24:     }
 25: }

Below is an example of how you can override the configured allowed page types in code:

  1: public class Global : EPiServer.Global
  2: {
  3:     protected void Application_Start(Object sender, EventArgs e)
  4:     {
  5:         FilteredPageReference.PropertyFilteredPageReferenceSettings.GetAllowedPageTypes = GetAllowedPageTypes;
  6:     }
  7: 
  8:     private void GetAllowedPageTypes(FilteredPageReference.AllowedPageTypes allowedPageTypes)
  9:     {
 10:         // below are properties available to interigate to determine the start page
 11:         string languageId = allowedPageTypes.PropertyInformation.LanguageId;
 12:         string pageId = allowedPageTypes.PropertyInformation.PageId;
 13:         int pageTypeId = allowedPageTypes.PropertyInformation.PageTypeId;
 14:         string parentPageId = allowedPageTypes.PropertyInformation.ParentPageId;
 15:         string propertyName = allowedPageTypes.PropertyInformation.PropertyName;
 16:         int workId = allowedPageTypes.PropertyInformation.WorkId;
 17: 
 18:         // allowed page types can be set either by setting the type array like the following:
 19:         allowedPageTypes.AllowedPageTypesAndInterfaces = new[] { typeof(PageTypeOne), typeof(PageTypeTwo) };
 20: 
 21:         // or page type names can be set by specifying like the following:
 22:         allowedPageTypes.PageTypeNames = PageType.List().Select(current => current.Name).Take(5).ToList();
 23:     }
 24: }

Feedback

Feedback as always is greatly received.  If there are bugs/issues please feel free to email or twitter me @croweman

Oct 05, 2011

Comments

Please login to comment.
Latest blogs
Optimizely Commerce Connect: Enabling content-driven ecommerce experiences

The world of ecommerce today is a rapidly evolving field. No longer are customers satisfied with a long list of products that they have no idea how...

Shahrukh Ikhtear | Jun 16, 2025

Create a multi-site aware custom search provider using Search & Navigation

In a multisite setup using Optimizely CMS, searching for pages can be confusing. The default CMS search regardless of search provider does not...

dada | Jun 12, 2025

Tunning Application Insights telemetry filtering in Optimizely

Application Insights is a cloud-based service designed to monitor web applications, providing insights into performance, errors, and user behavior,...

Stanisław Szołkowski | Jun 12, 2025 |

JavaScript SDK v6: Lightest, Most Efficient SDK Yet

Need a faster site and less frontend bloat? JavaScript SDK v6 is here —and it’s the lightest, smartest SDK we’ve ever released for Optimizely Featu...

Sarah Ager | Jun 11, 2025

Boosting Indexing Efficiency: Reindex Pages Directly from Optimizely’s Navigation Pane

There can be various reasons why you might want to trigger indexing or reindexing of a page/node directly from the navigation pane. In my case, we...

Praful Jangid | Jun 11, 2025

How to Get Started with Google Gemini and Imagen in Optimizely CMS

Bringing AI into your editorial workflow has never been easier. With Epicweb’s AI Assistant now supporting Google Gemini and Imagen, editors workin...

Luc Gosso (MVP) | Jun 9, 2025 |