private bool IsMultipleDataType(PublishedDataType dataType) { MediaPickerConfiguration?config = ConfigurationEditor.ConfigurationAs <MediaPickerConfiguration>(dataType.Configuration); return(config?.Multiple ?? false); }
/// <summary> /// Gets the wrapped data type key from the current data type's prevalues. /// </summary> /// <param name="wrapperDataType"></param> /// <returns></returns> private Guid GetWrappedDataTypeKey(PublishedDataType wrapperDataType) { Guid dataTypeKey = default; var configuration = wrapperDataType.ConfigurationAs <TextCountConfiguration>(); if (configuration == null) { return(dataTypeKey); } if (configuration.DataTypeKey.HasValue && configuration.DataTypeKey.Value != default) { dataTypeKey = configuration.DataTypeKey.Value; } else if (configuration.DataTypeId.HasValue && configuration.DataTypeId.Value != default) { var dataType = _dataTypeService.GetDataType(configuration.DataTypeId.Value); if (dataTypeKey != null) { dataTypeKey = dataType.Key; } } return(dataTypeKey); }
private IPublishedPropertyType GetPropertyType(BlockListConfiguration config) { var dataType = new PublishedDataType(1, "test", new Lazy <object>(() => config)); var propertyType = Mock.Of <IPublishedPropertyType>(x => x.EditorAlias == Constants.PropertyEditors.Aliases.BlockList && x.DataType == dataType); return(propertyType); }
public void Get_Value_Type_Single() { var editor = CreateConverter(); var config = ConfigForSingle(); var dataType = new PublishedDataType(1, "test", new Lazy <object>(() => config)); var propType = Mock.Of <IPublishedPropertyType>(x => x.DataType == dataType); var valueType = editor.GetPropertyValueType(propType); // the result is always block list model Assert.AreEqual(typeof(BlockListModel), valueType); }
private static PublishedPropertyType CreatePropertyType(string propertyEditorAlias, object dataTypeConfiguration, ContentVariation variation) { var uploadDataType = new PublishedDataType(1234, propertyEditorAlias, new Lazy <object>(() => dataTypeConfiguration)); var propertyValueConverters = new PropertyValueConverterCollection(new IPropertyValueConverter[] { new UploadPropertyConverter(), new ImageCropperValueConverter(Mock.Of <ILogger <ImageCropperValueConverter> >()), }); var publishedModelFactory = Mock.Of <IPublishedModelFactory>(); var publishedContentTypeFactory = new Mock <IPublishedContentTypeFactory>(); publishedContentTypeFactory.Setup(x => x.GetDataType(It.IsAny <int>())) .Returns(uploadDataType); return(new PublishedPropertyType("umbracoFile", 42, true, variation, propertyValueConverters, publishedModelFactory, publishedContentTypeFactory.Object)); }
/// <summary> /// Is the media picker configured to pick multiple media items /// </summary> /// <param name="dataType"></param> /// <returns></returns> private bool IsMultipleDataType(PublishedDataType dataType) { var config = dataType.ConfigurationAs <MediaPicker3Configuration>(); return(config.Multiple); }
private bool IsMultipleDataType(PublishedDataType dataType) => dataType.ConfigurationAs <MediaPicker3Configuration>().Multiple;
public BlockPublishedPropertyType(PublishedDataType dataType) { DataType = dataType; }
private static bool IsOnlyImagesDataType(PublishedDataType dataType) { var config = ConfigurationEditor.ConfigurationAs <MediaPickerConfiguration>(dataType.Configuration); return(config.OnlyImages); }
/// <summary> /// Returns whether the specified <paramref name="dataType"/> represents a multi picker. /// </summary> /// <param name="dataType">The data type.</param> /// <returns><c>true</c> if <paramref name="dataType"/> is a multi picker; otherwise <c>false</c>.</returns> private static bool IsMultiPicker(PublishedDataType dataType) { return(dataType.ConfigurationAs <ImagePickerConfiguration>()?.IsMultiPicker ?? false); }