public static List<Dynamic.Category> BuildCategories(TComm.Page page, BuildManager manager)
{
// note that there might be multiple fields based on the same category, so we need to combine them
// for that purpose we use a dictionary
if (page.Metadata == null)
{
return new List<Dynamic.Category>();
}
Dictionary<string, Dynamic.Category> categories = new Dictionary<string, Dynamic.Category>();
// first, add categires from the metadata
ItemFields tcmMetadataFields = new TCM.Fields.ItemFields(page.Metadata, page.MetadataSchema);
addFromItemFields(tcmMetadataFields, categories, manager);
// finally, create a List from the Dictionary and return it
List<Dynamic.Category> categoryList = new List<Dynamic.Category>();
foreach (Dynamic.Category cat in categories.Values)
{
categoryList.Add(cat);
}
return categoryList;
}