I'm trying to create a set of data types via code and have been able to successfully create and specify configuration for MediaPickerPropertyEditor and MultiUrlPickerPropertyEditor data types.
However, when I try to do this for the DropDownFlexiblePropertyEditor, I'm told I can't create the configuration due to it's protection level.
I'm wondering if there's any reason for this or if we could make this public so that I can specify items for the data editor?
To see this working, you can run the following code:
IDataEditor dataEditor = new MediaPickerPropertyEditor(_logger);
IDataType dataType = new DataType(dataEditor, KupoContainer.Id);
dataType.Name = "Kupo Image Picker";
dataType.Configuration = new MediaPickerConfiguration
{
Multiple = false,
DisableFolderSelect = true,
OnlyImages = true
};
_umbracoDataTypeService.Save(dataType);
This is how far I've got with the dropdown type:
IDataEditor dataEditor = new DropDownFlexiblePropertyEditor(_localizedTextService, _logger);
IDataType dataType = new DataType(dataEditor, KupoContainer.Id);
dataType.Name = "Kupo Change Frequency Picker";
ValueListConfiguration valueList = new ValueListConfiguration();
valueList.Items.Add(new ValueListConfiguration.ValueListItem { Value = "Weekly" });
dataType.Configuration = new DropDownFlexibleConfiguration();
_umbracoDataTypeService.Save(dataType);
This will thrown the following error:
'DropDownFlexibleConfiguration' is inaccesible due to its protection level.
Umbraco Version: 8.0.1
Should be one extremely easy PR, just need to make the class DropDownFlexibleConfiguration public instead of internal. Have marked up for grabs :)
Perfect, thanks @Shazwazza!
PR created 馃憤
Merged! 馃帀 nice one
Most helpful comment
Merged! 馃帀 nice one