Using an existing datatype control within the prevalue settings of a custom datatype
I've been tasked with creating a custom datatype to create a list of items as prevalues, which will then be parsed and rendered into a custom checkbox list usercontrol.
Ideally, the each item in the prevalue list will contain an image and two strings. The strings represent a feature and additional information for that feature, both of which will form a single item in a checkbox list - the feature forming the label, and the additional information being used as default values in a textbox. When the page is published, the selected items will be displayed on the page and use the associated images set in the prevalue settings for the icon of each item.
I've managed to build the basic control with the two text values (see attached image), but was stumped when throwing images into the equation as I'm still new to Umbraco & .NET development. Is there a way of embedding the Media Picker control into my datatype to set prevalues (perhaps using DataEditorSetting?), or is there a simple way of constructing a drop-down list of available images from a folder within Media?
This sounds like a complicated approach to me. I might have misunderstood the requirement, but how about a simple approach using standard Umbraco features:
Create a new a 'venue' media type which has all the properties of the standard 'image' media type and then add two new text fields for your additional information.
Create a new folder in the media section to put all your venue media items in.
Create a new datatype (in the backend interface as opposed to code) which is a multi node tree picker type and set it to have your new media folder as the root folder.
Include this new datatype in any document types that require your 'venue' selection.
Modify an exisiting macro for displaying the selected media items in your templates.
Thanks for this - it's definitely something I will try. The only thing I will need to figure out is how to allow editors to amend the second text field (although I've got a few ideas already).
Ah, that would be the part of the requirement that I had missed!
Okay this is a bit of a fudge, but how about putting the fixed text entry in the new media type and then using the uComponents Multi-URL Picker (for which you only enable Media) and then use the title field for the variable second text entry.
And if not then the source code might give you the answer to you original question about selecting media items in you own control.
No problem - I also forgot to mention that we have the prevalue option to "show" the additional details (by default it behaves just like a checkbox list datatype and doesn't allow the editors to edit/add the additional information). I've also been told that we may need other prevalues on this datatype to set a minimum and maximum of items an editor can select (e.g. there must be a minimum of 5, but no more than 10).
In any case, I've been browsing the forums and have a couple of other approaches to explore if the new Media type doesn't solve our user's requirements:
Just to close this topic off - we've actually had to use a drop-down text list of available icons (which is configured in a different Data Type), and this value is used to set the class of the item on the page.
While building this we actually came across (and fixed) a bug with the core "Values" SettingsControl - the JavaScript breaks when you include non-alphanumeric characters (like "Fish & Chips") - now reported here: http://issues.umbraco.org/issue/U4-742
Using an existing datatype control within the prevalue settings of a custom datatype
I've been tasked with creating a custom datatype to create a list of items as prevalues, which will then be parsed and rendered into a custom checkbox list usercontrol.
Ideally, the each item in the prevalue list will contain an image and two strings. The strings represent a feature and additional information for that feature, both of which will form a single item in a checkbox list - the feature forming the label, and the additional information being used as default values in a textbox. When the page is published, the selected items will be displayed on the page and use the associated images set in the prevalue settings for the icon of each item.
I've managed to build the basic control with the two text values (see attached image), but was stumped when throwing images into the equation as I'm still new to Umbraco & .NET development. Is there a way of embedding the Media Picker control into my datatype to set prevalues (perhaps using DataEditorSetting?), or is there a simple way of constructing a drop-down list of available images from a folder within Media?
This sounds like a complicated approach to me. I might have misunderstood the requirement, but how about a simple approach using standard Umbraco features:
Hope this is helpful!
Thanks for this - it's definitely something I will try. The only thing I will need to figure out is how to allow editors to amend the second text field (although I've got a few ideas already).
Ah, that would be the part of the requirement that I had missed!
Okay this is a bit of a fudge, but how about putting the fixed text entry in the new media type and then using the uComponents Multi-URL Picker (for which you only enable Media) and then use the title field for the variable second text entry.
And if not then the source code might give you the answer to you original question about selecting media items in you own control.
No problem - I also forgot to mention that we have the prevalue option to "show" the additional details (by default it behaves just like a checkbox list datatype and doesn't allow the editors to edit/add the additional information). I've also been told that we may need other prevalues on this datatype to set a minimum and maximum of items an editor can select (e.g. there must be a minimum of 5, but no more than 10).
In any case, I've been browsing the forums and have a couple of other approaches to explore if the new Media type doesn't solve our user's requirements:
Failing that...
Just to close this topic off - we've actually had to use a drop-down text list of available icons (which is configured in a different Data Type), and this value is used to set the class of the item on the page.
While building this we actually came across (and fixed) a bug with the core "Values" SettingsControl - the JavaScript breaks when you include non-alphanumeric characters (like "Fish & Chips") - now reported here: http://issues.umbraco.org/issue/U4-742
is working on a reply...