public static void SetValues(
     ContentPartFieldDefinitionBuilder builder,
     ContentPickerFieldGDPRPartFieldSettings settings)
 {
     // anonymization settings
     builder.WithSetting(
         "ContentPickerFieldGDPRPartFieldSettings.AttemptToAnonymizeItems",
         settings.AttemptToAnonymizeItems.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "ContentPickerFieldGDPRPartFieldSettings.DetachGDPRItemsOnAnonymize",
         settings.DetachGDPRItemsOnAnonymize.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "ContentPickerFieldGDPRPartFieldSettings.DetachAllItemsOnAnonymize",
         settings.DetachAllItemsOnAnonymize.ToString(CultureInfo.InvariantCulture));
     // erasure settings
     builder.WithSetting(
         "ContentPickerFieldGDPRPartFieldSettings.AttemptToEraseItems",
         settings.AttemptToEraseItems.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "ContentPickerFieldGDPRPartFieldSettings.DetachGDPRItemsOnErase",
         settings.DetachGDPRItemsOnErase.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "ContentPickerFieldGDPRPartFieldSettings.DetachAllItemsOnErase",
         settings.DetachAllItemsOnErase.ToString(CultureInfo.InvariantCulture));
 }
Esempio n. 2
0
 /// <summary>
 /// Create a ViewModel based on the settings provided. This method is really simple to begin
 /// with, to the point where it's not even really needed, but I create it already so that when
 /// the model becomes more complex I don't have to refactor code.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 private ContentPickerFieldGDPRPartFieldSettingsViewModel MakeViewModel(
     ContentPickerFieldGDPRPartFieldSettings settings, string fieldName)
 {
     return(new ContentPickerFieldGDPRPartFieldSettingsViewModel {
         Settings = settings,
         AnonymizationDivId = AnonymizationDivId(fieldName),
         ErasureDivId = ErasureDivId(fieldName)
     });
 }
Esempio n. 3
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(
            ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (!_typeHasGDPRPart)
            {
                yield break;
            }
            //we only do stuff for ContentPickerFields
            if (builder.FieldType != "ContentPickerField")
            {
                yield break;
            }

            var vm = new ContentPickerFieldGDPRPartFieldSettingsViewModel();

            if (updateModel.TryUpdateModel(vm, "ContentPickerFieldGDPRPartFieldSettingsViewModel", null, null))
            {
                var settings = vm.Settings;
                ContentPickerFieldGDPRPartFieldSettings.SetValues(builder, settings);
            }
        }