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 || page.MetadataSchema == 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;
        }
        public static List<Dynamic.Category> BuildCategories(TCM.Component component, 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
            Dictionary<string, Dynamic.Category> categories = new Dictionary<string, Dynamic.Category>();

            // first, add categories from the content (note that mm components have no content!)
            if (component.Content != null)
            {
                ItemFields tcmFields = new TCM.Fields.ItemFields(component.Content, component.Schema);
                addFromItemFields(tcmFields, categories, manager);
            }

            // next, add categories from the metadata
            if (component.Metadata != null)
            {
                ItemFields tcmMetadataFields = new TCM.Fields.ItemFields(component.Metadata, component.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;
        }
예제 #3
0
        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 || page.MetadataSchema == 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);
        }
예제 #4
0
        public static List <Dynamic.Category> BuildCategories(TCM.Component component, 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
            Dictionary <string, Dynamic.Category> categories = new Dictionary <string, Dynamic.Category>();

            // first, add categories from the content (note that mm components have no content!)
            if (component.Content != null)
            {
                ItemFields tcmFields = new TCM.Fields.ItemFields(component.Content, component.Schema);
                addFromItemFields(tcmFields, categories, manager);
            }

            // next, add categories from the metadata
            if (component.Metadata != null)
            {
                ItemFields tcmMetadataFields = new TCM.Fields.ItemFields(component.Metadata, component.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);
        }