Documentation

LocalizedSortedList

This is a simple SortedList<string, string> that is used to house the various culture specific Html content for a page. Content properties that are composed of LocalizedSortedLists are Body, Title, AbbrevTitle, and Summary.
 

OpenRoad.ThoughtFarmer.Shared.Core.Content.LocalizedSortedList

There are no properties or methods in the class that are available for use within custom cards. Instead use the following extensions methods.
 


OpenRoad.ThoughtFarmer.Core.Extensions.LocalizedSortedListExtensions

Methods
Name Description
Get(this LocalizedSortedList localizedSortedList, string culture, IContext context, bool encode = false) Returns the string content for the supplied culture string. If none found for specified culture will return the site default culture's content. Encode will set if the content should be Html encoded or not.
GetSpecific(this LocalizedSortedList localizedSortedList, string culture, IContext context, bool encode = false) Returns the string content for the supplied culture string. Empty if not found. Encode will set if the content should be Html encoded or not.


Example usage
 
@using OpenRoad.ThoughtFarmer.Core.Repositories

@{

 var pageContentRepository = new PageContentRepository(this.Model.Context.Config.LocalizationDefaultCulture, this.Model.Context.Config.LocalizationAvailableCultures);
 var page = this.Api.Content.Get(123); // Some other page we want to pull content from

 if(page != null)
 {
      var title = page.Title.Get(this.Model.Context.Culture, this.Model.Context); 
      var body = pageContentRepository.GetBody(page.Node.ContentId).Get(this.Model.Context.Culture, this.Model.Context);

      &lt;div class="tfc-custom-container"&gt;
             &lt;h2&gt;@title&lt;/h2&gt;
             &lt;div class="tf-content"&gt;
                @Raw(body)
             &lt;/div&gt;
      &lt;/div&gt;
 }

}


Note the use of PageContentRepository above to get the body content from a page. You will need to add the using directive to access this repository class. 

To display Html strings properly you must specify @Raw(string).