internal static string SerializeIds(this ContentPickerField picker) { if (picker == null) { return(String.Empty); } return(picker.Ids.SerializeIds()); }
internal static IEnumerable <T> GetPickedContentAs <T>(this ContentPickerField picker) where T : IContent { if (picker != null && picker.ContentItems != null && picker.ContentItems.Any()) { return(picker.ContentItems.Select(item => item.As <T>()).Where(t => t != null)); } return(Enumerable.Empty <T>()); }
protected override DriverResult Editor(ContentPart part, ContentPickerField field, IUpdateModel updater, dynamic shapeHelper) { return(Editor(part, field, shapeHelper)); }
private ContentPickerFieldGDPRPartFieldSettings Setting(ContentPickerField field) { return field.PartFieldDefinition.Settings.GetModel<ContentPickerFieldGDPRPartFieldSettings>(); }
private bool ShoulDetachAll(GDPRContentContext context, ContentPickerField field) { return context.Erase ? Setting(field).DetachAllItemsOnErase : Setting(field).DetachAllItemsOnAnonymize; }
private int[] RemainingIds(ContentPickerField field, Func<ContentItem, bool> shouldRemain) { var items = _contentManager.GetMany<ContentItem>(field.Ids, VersionOptions.AllVersions, QueryHints.Empty); return items.Where(shouldRemain).Select(ci => ci.Id).Distinct().ToArray(); }
private bool CheckFlag(GDPRContentContext context, ContentPickerField fi) { var settings = fi.PartFieldDefinition.Settings.GetModel<ContentPickerFieldGDPRPartFieldSettings>(); return context.Erase ? settings.AttemptToEraseItems : settings.AttemptToAnonymizeItems; }
protected override void Cloning(ContentPart part, ContentPickerField originalField, ContentPickerField cloneField, CloneContentContext context) { cloneField.Ids = originalField.Ids; }