/// <summary> /// Retrieves the additional properties. /// </summary> /// <param name="archetype">The archetype.</param> /// <param name="preValue">The pre value.</param> private void RetrieveAdditionalProperties(ref ArchetypeModel archetype, ArchetypePreValue preValue) { foreach (var fieldset in preValue.Fieldsets) { var fieldsetAlias = fieldset.Alias; foreach (var fieldsetInst in archetype.Fieldsets.Where(x => x.Alias == fieldsetAlias)) { foreach (var property in fieldset.Properties) { var propertyAlias = property.Alias; foreach (var propertyInst in fieldsetInst.Properties.Where(x => x.Alias == propertyAlias)) { propertyInst.DataTypeGuid = property.DataTypeGuid.ToString(); propertyInst.DataTypeId = ExecutionContext.DatabasePersistence.GetNodeId( property.DataTypeGuid, UmbracoNodeObjectTypeIds.DataType); propertyInst.PropertyEditorAlias = property.PropertyEditorAlias; } } } } }
/// <summary> /// Retrieves additional metadata that isn't available on the stored model of an ArchetypePreValue /// </summary> /// <param name="archetype">The Archetype to add the additional metadata to</param> /// <param name="preValue">The configuration of the Archetype</param> private void RetrieveAdditionalProperties(ref ArchetypePreValue preValue) { foreach (var fieldset in preValue.Fieldsets) { foreach (var property in fieldset.Properties) { property.PropertyEditorAlias = GetDataTypeByGuid(property.DataTypeGuid).PropertyEditorAlias; } } }
/// <summary> /// Retrieves the additional properties. /// </summary> /// <param name="preValue">The pre value.</param> private void RetrieveAdditionalProperties(ref ArchetypePreValue preValue) { if (preValue == null) return; foreach (var fieldset in preValue.Fieldsets) { foreach (var property in fieldset.Properties) { var dataType = ExecutionContext.DatabasePersistence.RetrieveItem<DataType>( new ItemIdentifier(property.DataTypeGuid.ToString(), ItemProviderIds.dataTypeItemProviderGuid)); if (dataType == null) continue; property.PropertyEditorAlias = dataType.PropertyEditorAlias; } } }
/// <summary> /// Retrieves additional metadata that isn't available on the stored model of an Archetype /// </summary> /// <param name="archetype">The Archetype to add the additional metadata to</param> /// <param name="preValue">The configuration of the Archetype</param> private void RetrieveAdditionalProperties(ref ArchetypeModel archetype, ArchetypePreValue preValue, PublishedContentType hostContentType = null) { foreach (var fieldset in preValue.Fieldsets) { var fieldsetAlias = fieldset.Alias; foreach (var fieldsetInst in archetype.Fieldsets.Where(x => x.Alias == fieldsetAlias)) { foreach (var property in fieldset.Properties) { var propertyAlias = property.Alias; foreach (var propertyInst in fieldsetInst.Properties.Where(x => x.Alias == propertyAlias)) { propertyInst.DataTypeGuid = property.DataTypeGuid.ToString(); propertyInst.DataTypeId = GetDataTypeByGuid(property.DataTypeGuid).Id; propertyInst.PropertyEditorAlias = property.PropertyEditorAlias; propertyInst.HostContentType = hostContentType; } } } } }