+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Products module: Overview - Building modules based on Generic Content module

by Ivan Osmak
[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]

 

Implementing Generic Content based module


As its name suggests, Generic Content module is a module that was built for working with content in general. Since Sitefinity is a Content Management application, chances are majority of the modules you will build will need same or similar features provided by Generic Content module. Building a module based on Generic Content module will drastically reduce the amount of time and code you will need in order to implement your module. In fact, many of our built-in modules are built on top of Generic Content module and reuse the features offered by it. Some examples are:
  • News module
  • Events module
  • Blogs module
  • Images & Documents module

What are the features offered by Generic Content module that you can reuse?



There are many features that are implemented directly on the Generic Content module so that they can be reused across all modules based on it. Here is the list of more important features that other modules can:
  • Dynamic metafields
    Any Generic Content based module can have dynamic meta fields attached to each content object. The meta fields are defined in web.config and require no additional coding (in terms of data access layer and persistence). So, for example, News module has meta fields such as “Author”, “Source”, Blogs module has meta fields such as “Title”, “Publication date”. To create different meta fields, a simple modification in web.config will suffice (and of course UI modification).
  • Categories
    Generic content module provides ability to categorize content out of box. So whatever type of content that you will be creating, you can allow end users to categorize it with no additional work needed.
  • Tags
    Similarly to Categories, Generic Content also provides built in support for tagging of content. No additional work will be needed here as well.
  • Comments
    If you wish to allow the visitors to comment on the content your module will generate, again, you can take advantage of the built in commenting system.
  • Permissions
    Your Generic Content based module can also take advantage of the built in permissions, so that you can define which users can do what. Once again, no additional coding required!
  • Workflow
    Generic Content based modules also come with built in ability to control the workflow of content creation. So the content items your module will manage can go through stages such as Draft, Waiting for approval, Published and so on.
  • Localization
    When you build module based on Generic Content you will also have out of box option to localize content, in the same manner News or Blogs module do so. And yes… with no additional coding.
  • Production ready public base control
    When you build a module based on Generic Content you will have the ability to build your public controls on top of Content View control, which is a production ready, powerful and extensible control for displaying your content items on the public side of the website. You will automatically get the paging, sorting and filtering features (and many more actually), that you can reuse as they are or override and provide your own implementation. To demonstrate the flexibility of this control, it is enough to say that standard Sitefinity controls, such as News View, Blog Posts and Events View are all based on Content View (even though they appear quite different).
  • Extensible - ready made public control designers
    When you are developing your public controls based on the Content View control you can also take advantage of our extensible Content View designers, which will make the process of creating user friendly control designer a breeze. In addition to this, you can simply plug in new settings for the designer with minimum amount of code.

So, as you can see, building a module based on Generic Content may prove advantageous for many reasons. But, there is also another reason why you may want to build your module based on the Generic Content module – namely, Generic Content module is one of the pillars of Sitefinity and as such it is constantly being improved and new features are being added. If your module is based on Generic Content module you will be able to very easily take advantage of all new improvements in the next version.

 
You can download and examine a sample Products module from here. Products module is a sample module based on Generic Content.


Leave a comment