How can you create a custom type for a macro parameter? I know you can create custom datatypes in the developer section, which by default contains things like "Richtext Editor" and "Ultimate Picker", but I want new types in the macro parameters tab, which has things like "bool" and "number" and "propertyTypePicker".
Basically I want to have a dropdown that can pull information from an outside database and give an ID to the macro (instead of the user having to look up the ID themselves and type it into a text box), which the macro will then use to display information on a page.
It was made for V3, but I imagine it would work fine i V4. It actually does just what you want. Populate a dropdown box based on a provider model. So dig into that code, and you should have all the basics.
Custom Macro Parameter Type
How can you create a custom type for a macro parameter? I know you can create custom datatypes in the developer section, which by default contains things like "Richtext Editor" and "Ultimate Picker", but I want new types in the macro parameters tab, which has things like "bool" and "number" and "propertyTypePicker".
Basically I want to have a dropdown that can pull information from an outside database and give an ID to the macro (instead of the user having to look up the ID themselves and type it into a text box), which the macro will then use to display information on a page.
Thanks,
Mike
You'd have to write your own DataType for this.
Check out some info in this blog post: http://www.nibble.be/?p=24
There is a pretty good writeup on how to do that in this old forum post:
http://forum.umbraco.org/yaf_postst2224_Extending-macro-datatype.aspx
Also you may want to check out the project that Ismail created here:
http://umbracoext.codeplex.com/SourceControl/changeset/view/35482#201463
It was made for V3, but I imagine it would work fine i V4. It actually does just what you want. Populate a dropdown box based on a provider model. So dig into that code, and you should have all the basics.
Sebastiaan > it is not a datatype, but a macrorendering that is needed. It is used for the properties in a macro instead of a document.
Whoops. I wasn't reading properly! Sorry, it's been a long day :-)
Thanks very much Morten! That is exactly what I was looking for.
is working on a reply...