/// <summary> /// Fills the specification keys. /// </summary> /// <param name="template">The template.</param> /// <param name="spec">The spec.</param> private void FillSpecificationKeys([NotNull] TemplateItem template, [NotNull] ref Collection <string> spec) { Assert.ArgumentNotNull(template, "template"); Assert.ArgumentNotNull(spec, "spec"); TemplateSectionItem section = template.GetSection("Specification"); if (section == null) { return; } foreach (TemplateFieldItem field in section.GetFields()) { if (!spec.Contains(field.Name)) { spec.Add(field.Name); } } foreach (TemplateItem baseTemplate in template.BaseTemplates) { this.FillSpecificationKeys(baseTemplate, ref spec); } }
public TemplateSection(TemplateSectionItem sectionItem, bool isContributing) { IsContributing = isContributing; RegionName = sectionItem.Name; RegionClassName = DomUtil.ConvertCaseString(sectionItem.Name); TemplateFieldItem[] fieldItems = sectionItem.GetFields(); TemplateFields = fieldItems != null ? fieldItems.Select(fieldItem => new TemplateField(fieldItem)) : null; }
/// <summary> /// Converts the section. /// </summary> /// <param name="item">The requested item.</param> /// <param name="section">The section.</param> /// <param name="writer">The writer.</param> private static void ConvertSection(Item item, TemplateSectionItem section, XmlTextWriter writer) { if (section != null) { foreach (TemplateFieldItem fieldInfo in section.GetFields()) { Field field = item.Fields[fieldInfo.ID]; if (field != null) { ConvertField(field, writer); } } } }
/// <summary> /// Loads the section. /// </summary> /// <param name="template">The template.</param> /// <param name="section">The section.</param> private static void LoadSection(TemplateDefinition template, TemplateSectionItem section) { Assert.ArgumentNotNull((object)template, "template"); Assert.ArgumentNotNull((object)section, "section"); SectionDefinition sectionDefinition = new SectionDefinition() { SectionID = section.ID.ToString(), Name = section.Name, Sortorder = section.Sortorder.ToString() }; template.AddSection(sectionDefinition); foreach (TemplateFieldItem field in section.GetFields()) TemplateBuilderForm.LoadField(sectionDefinition, field); sectionDefinition.Fields.Sort((IComparer)new FieldComparer()); }