I have a scenario where I want to extend an existing content type, but do not have access to its code to extend it. Is there a way to add properties programmatically to that content type? I do have access to its view so I can use that new property, but not the code of the block.
A bit of an odd case but you can probably look into how a property is stored when added manually in Admin Mode and use similar code in a "late" dependant Initialization Module. Then use the dictionary in the view, ContentData["NewProperty"] or something like that should work.
If possible it's a lot cleaner to inherit the original "closed source" content type and convert existing blocks to the new type that has more properties.
I was hoping to avoid subclassing, it creates a lot of work for my editors, and adds a duplicate content type to library. I was hoping someone knew of the specific service to use internally to add those properties to the data definition. And be able to do advanced things like selection feeds and attributes as well. If the admin can do it, there must be a way for me to do it I think.
I found a way to do this reliably after poking through the decompiled code used in the content types admin pages. Was a lot easier than I thought it would be. I will post a followup with code examples on this shortly.
Here is another option that also gives you the ability to use typed properties in your views. Not tested in CMS 12 though, but as far as I can see, there has been no changes to the service that I'm extending in this example: