Do you have a Generic content example?
See original GitHub issueHey Håkan - have just started using Piranha and loving it!
I’m trying out rc2 and am eager to see the generic content content stuff. I can see in the source that there’s a manager page for groups etc, was wondering if you had a quick example somewhere on how to preview it…?
I managed to get as far as this, but I was not able to create a new “Product” from the management screen - keeps flagging a console error "Cannot read property ‘create’ of undefined… I’m guessing I have probably missed something
[ContentGroup(Title = "Content", Id = "Content")] [ContentType(Group = "Content", Id ="Product",Title = "Title")] public class ProductContent : Content<ProductContent> { [Region(Title = "Zoom")] public TextField SomeText{ get; set; } }
Cheers and great job!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Hi there! We’re working on the new documentation sections for
9.0
, so it’s not strange that you haven’t found information about it. There’s some examples on it in our repo in theRazorWeb
example:https://github.com/PiranhaCMS/piranha.core/tree/master/examples/RazorWeb/Models/Content
In short the key concept is that a
Group
equals an abstract base class, for example:The content types available for this group is then the classes that inherit from this base class, for example:
Best regards
The purpose is to be able to create different repositories with reusable content pieces that can be used from pages and posts.
For example groups could be Products and Banners, and in Products you could have two Content Types Computers and Monitors.