Umbraco-cms: V8: Can't set configuration for DropDownFlexiblePropertyEditor

Created on 15 Apr 2019  路  3Comments  路  Source: umbraco/Umbraco-CMS

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?

Reproduction

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.

Specifics

Umbraco Version: 8.0.1

communitpr releas8.0.2

Most helpful comment

Merged! 馃帀 nice one

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings