• Publisert
  • 1 min

New features for the Meridium.FolderBrowserProperty

I have togheter with Håkon Nordli at NorgesGruppen, made som new features for the Meridium.FolderBrowserProperty. The property itself lets you choose a folder from the filearchive in EPiServer. Our expansion lets you choose multiple folders using only one property. We have called the new property MultiFolderProperty, and the expansion is made in the Meridium.FolderBrowserProperty source which you can download on epicode.

First of all I would like to start with a screenshot of the new MultiFolderProperty:

Here you can press the button "Legg til ny" to add a new FolderBrowserProperty where you can choose another folderpath.

If you are using PageTypeBuilder, you can create a property like this:

 

[PageTypeProperty(Searchable = false, SortOrder = 100, Tab = typeof(Tabs.InformationTab), Type = typeof(PropertyMultiFolder), UniqueValuePerLanguage = false)]

[PageTypeProperty(Searchable = false, SortOrder = 100, Tab = typeof(Tabs.InformationTab), Type = typeof(PropertyMultiFolder), UniqueValuePerLanguage = false)]
public virtual string Folders { get; set; }

Since the property gives you a comma delimited string of folders, it's perfect for for setting the searchlocations of EPiServers searchdatasource like this:

_searchDataSource.SearchLocations = CurrentPage.Folders;

If you want to delete some of the folders, you first have to either press the link "Fjern sti" or just clear the value in the textbox. When you then save and publish, these values will be removed. The property also filters out paths that are not unique if the editor accidentally should choose the same path twice.

I hope you will enjoy the MultiFolderProperty, and I would like to thank NorgesGruppen ASA for letting us contribute this back to the community.

Also a big thanks to Håkon Nordli at NorgesGruppen for his contribution to this solution. You can follow Håkon on twitter at @hakonnordli

You can check out the project here: https://www.coderesort.com/p/epicode/wiki/FolderBrowserProperty