Get Contentment prevalues from Settings in code
# help-with-umbraco
i
I'm using a Contentment Data List (user-defined list) and setting the Data source items in the Settings section. How can I get the values when retrieving the datatype via the umbraco DataTypeService? Do I need to convert the settings object to json or a strongly typed model?
l
There's an API controller that can return the Data List's source items, it's what I use for the Data List preview component. https://github.com/leekelleher/umbraco-contentment/blob/5.0.1/src/Umbraco.Community.Contentment/DataEditors/DataList/DataListApiController.cs#L49-L61 This will give you the configuration for the list-editor, so the data-source items will be in a field called
"items"
. Feel free to reuse that endpoint, or extract the inner workings of it, etc.
i
@leekelleher thanks very much !!
9 Views