/// <summary> /// Gets the fields of a specific item version. /// </summary> /// <param name="itemDefinition">The item.</param> /// <param name="versionUri">The version URI.</param> /// <param name="context">The context.</param> /// <returns>Sitecore.Data.FieldList.</returns> public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context) { if (!_setupComplete) { return(base.GetItemFields(itemDefinition, versionUri, context)); } var fields = new FieldList(); var sectionInfo = SectionTable.FirstOrDefault(x => x.SectionId == itemDefinition.ID); if (sectionInfo != null) { GetStandardFields(fields, sectionInfo.SectionSortOrder >= 0 ? sectionInfo.SectionSortOrder : (SectionTable.IndexOf(sectionInfo) + 100)); return(fields); } var fieldInfo = FieldTable.FirstOrDefault(x => x.FieldId == itemDefinition.ID); if (fieldInfo != null) { GetStandardFields(fields, fieldInfo.FieldSortOrder >= 0 ? fieldInfo.FieldSortOrder : (FieldTable.IndexOf(fieldInfo) + 100)); GetFieldFields(fieldInfo, fields); return(fields); } return(base.GetItemFields(itemDefinition, versionUri, context)); }
/// <summary> /// Gets the fields of a specific item version. /// </summary> /// <param name="itemDefinition">The item.</param> /// <param name="versionUri">The version URI.</param> /// <param name="context">The context.</param> /// <returns>Sitecore.Data.FieldList.</returns> public override global::Sitecore.Data.FieldList GetItemFields(global::Sitecore.Data.ItemDefinition itemDefinition, global::Sitecore.Data.VersionUri versionUri, CallContext context) { // Setup(context); FieldList fields = new FieldList(); var sectionInfo = SectionTable.FirstOrDefault(x => x.SectionId == itemDefinition.ID); if (sectionInfo != null) { GetStandardFields(fields, sectionInfo.SectionSortOrder >= 0 ? sectionInfo.SectionSortOrder : (SectionTable.IndexOf(sectionInfo) + 100)); return fields; } var fieldInfo = FieldTable.FirstOrDefault(x => x.FieldId == itemDefinition.ID); if (fieldInfo != null) { GetStandardFields(fields, fieldInfo.FieldSortOrder >= 0 ? fieldInfo.FieldSortOrder : (FieldTable.IndexOf(fieldInfo) + 100)); GetFieldFields(fieldInfo, fields); return fields; } return base.GetItemFields(itemDefinition, versionUri, context); }