I'm looking to populate content programatically that has a property that is a Stacked Content datatype.
Most of the code I can see in InnerContent seems to be dealing with converting from the existing property value - is there something already there I can hook into, or an existing object I can create and serialize?
Otherwise I guess I'll have to create a class with the same properties that you're serializing (key, name, icon, icContentTypeGuid) and serialize it along with the property values I need.
Yeah, as you say, there's nothing in Inner/Stacked Content that will aid you creating items programmatically... and yes, (as you mentioned), the raw value would need to be a JSON string, like so...
OK, as long as I know I'm not recreating something that you've already done.
One of the tricky bits looks like getting the name property because I don't have access to angular's $interpolate to generate it, I might have to just stick with the doctype name for now.
Creating Stacked/Inner Content programmatically
Hi,
I'm looking to populate content programatically that has a property that is a Stacked Content datatype.
Most of the code I can see in InnerContent seems to be dealing with converting from the existing property value - is there something already there I can hook into, or an existing object I can create and serialize?
Otherwise I guess I'll have to create a class with the same properties that you're serializing (key, name, icon, icContentTypeGuid) and serialize it along with the property values I need.
Stephen
Hi Stephen,
Yeah, as you say, there's nothing in Inner/Stacked Content that will aid you creating items programmatically... and yes, (as you mentioned), the raw value would need to be a JSON string, like so...
The only reason we haven't added code for this, is that we haven't had a personal/client need for it yet.
If you do end up making any generic helper methods to help with this, I'd be open for contributions for Inner Content.
Cheers,
- Lee
OK, as long as I know I'm not recreating something that you've already done.
One of the tricky bits looks like getting the name property because I don't have access to angular's $interpolate to generate it, I might have to just stick with the doctype name for now.
Nope, definitely not recreating anything :-)
With the name, you could try C# string interpolation? e.g.... Update, ignore me, I'd forgot about the DataType config.$"Some feature: {alias1}"
is working on a reply...