Example #1
0
 public static void SetValues(
     ContentPartFieldDefinitionBuilder builder,
     MediaLibraryPickerFieldGDPRPartFieldSettings settings)
 {
     // anonymization settings
     builder.WithSetting(
         "MediaLibraryPickerFieldGDPRPartFieldSettings.AttemptToAnonymizeItems",
         settings.AttemptToAnonymizeItems.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "MediaLibraryPickerFieldGDPRPartFieldSettings.DetachGDPRItemsOnAnonymize",
         settings.DetachGDPRItemsOnAnonymize.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "MediaLibraryPickerFieldGDPRPartFieldSettings.DetachAllItemsOnAnonymize",
         settings.DetachAllItemsOnAnonymize.ToString(CultureInfo.InvariantCulture));
     // erasure settings
     builder.WithSetting(
         "MediaLibraryPickerFieldGDPRPartFieldSettings.AttemptToEraseItems",
         settings.AttemptToEraseItems.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "MediaLibraryPickerFieldGDPRPartFieldSettings.DetachGDPRItemsOnErase",
         settings.DetachGDPRItemsOnErase.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "MediaLibraryPickerFieldGDPRPartFieldSettings.DetachAllItemsOnErase",
         settings.DetachAllItemsOnErase.ToString(CultureInfo.InvariantCulture));
 }
Example #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 MediaLibraryPickerFieldGDPRPartFieldSettingsViewModel MakeViewModel(
     MediaLibraryPickerFieldGDPRPartFieldSettings settings, string fieldName)
 {
     return(new MediaLibraryPickerFieldGDPRPartFieldSettingsViewModel {
         Settings = settings,
         AnonymizationDivId = AnonymizationDivId(fieldName),
         ErasureDivId = ErasureDivId(fieldName)
     });
 }
Example #3
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(
            ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (!_typeHasGDPRPart)
            {
                yield break;
            }
            //we only do stuff for MediaLibraryPickerFields
            if (builder.FieldType != "MediaLibraryPickerField")
            {
                yield break;
            }

            var vm = new MediaLibraryPickerFieldGDPRPartFieldSettingsViewModel();

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