Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've just implemented a Data List picker using an XML file for the data and an Item Picker as the editor.
The XML is very simple values like this:
I am selecting the @id attribute (because it's guaranteed unique) as the key and the content (text()) as the name.
When I need to output this on the frontend, I need to render the name instead of the key, but the value I get from Models Builder is (probably rightly so) the key.
I'd love to not have to do my own lookup into the XML file for this - is there a way to get access to the .Name, .Icon etc. properties of the picked item from within my partials?
Are you using your own custom XML data source? Or the one build in to Contentment?
If you have build a custom data source (via your own C# class), you can have the class implement the IDataListSourceValueConverter interface - there is a bit of documentation here:
The default XmlDataListSource class does however not implement this interface, so it will return the what you have configured to be the value. From what I can tell, it currently doesn't support getting the entire XML element instead of just the ID.
Good point. It was by design (as in I only needed the value/key for my original use case), but I'll put some thought on how it could be evolved.
Thanks Anders & Lee,
Yes, I'm using the built-in XML data source - I'll have a look at the IDataListSourceValueConverter to see if it makes sense for me to try (I had seen it but didn't think I'd ever be needing anything out of the ordinary, haha :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted