Generic Light Blue Hero Background

Custom Content Types | Progress Sitefinity

Sep 24, 2019

Customer Content Types

Sitefinity’s Module Builder helps you address unique project requirements by allowing you to define custom content types using a web-based interface. You can define new data models and then define one-to-one, one-to-many or many-to-many associations with other content types.  

We create a custom content type by navigating to Administration and then clicking Module Builder. Click on Create a module and give your module a name. A module is a collection of content types, which can be standalone, related or then can also have a parent-child relationship. In this video we’ll create a module for Progress Software partnerships, so let’s call our module Partners.  

Our first content type would be called Product. It would store information about the Progress Software products. The other content type will store information about the organizations Progress Software partnered with for those products and it will be called Partners.  

Let’s first create the Product content type. It will have a very basic structure of two fields, a Title and a Description. By default, there would be an identifier field called Title added to the structure of my content type, so we can just keep it and move directly to adding the Description field. As you can see under Type, fields can be of various types: short or long text, multiple choice, Boolean values, dates, number, addresses, related media or related content. For the Description field I need a long text type and you can decide if you want to use the Rich text editor or allow users to simply input plain text. Press Continue and you are now able to define the label and instructional text for the field. We can also decide whether this field should be required or not. Since it’s the only field I’m adding, it’s probably a good idea to make it required. Click Done and Finish to create our first content type.  

Now, I can activate the module, and what’s happening in the background is that Sitefinity is preparing the database for this new content type. It’s making sure we can store that information, but it’s also adapting the backend interface so that we can manage it.  

Before we continue, let’s create the other content type, the Partner. The Partner content type will have a more complex structure. Again, we have the Title field we can just change the label of, and name Company name. The other field I would add is the Company Description. Since this field is used by the developers, no spaces are allowed. Again, it’s of type Long text and again I’ll use the Rich text editor, preserving the formatting options for the content authors. Let’s add another field, this time, Related media storing the logo of the company. I can select whether a single image is allowed, or multiple images can be uploaded. In this example, let’s limit it to a single image. I can also control the maximum file size and the allowed extensions for the uploads. The final field I would add would be of type Related data. It would associate the Progress Software products with the partner companies, so let’s choose the Products type and name the field Product. Again, click Done and Finish when you’re ready. The database and the interface will be updated to reflect the new changes.  

Let’s check that! Let’s go under Content and we should now be able to see the new section for the new module called Partners, which contains the new content types we created: Products and Partners. Let’s create our first product. It will be Sitefinity Insight. Sitefinity Insight is the unified marketing command center for Sitefinity, so let’s add the description of the product and Publish when we’re ready. Let’s create another product. This time, it will be called NativeScript. This is our open-source framework for developing native mobile applications. Again, click Publish. Now that we’ve created our two products, let’s create the actual partnerships. The Sitefinity Insight is hosted in Azure, so the first partner we would add is Microsoft Corporation. Let’s add the description of the company, its logo, and the associated product would be Sitefinity Insight. For our second product partnership, we would create Google LLC, since NativeScript was developed by working with the Google team. Let’s add the description of the company, the logo and the related product would be NativeScript.  

In a couple of minutes, we created a module containing two content types, we populated both the Product and the Partners with content and we are now able to use that data on the Sitefinity frontend and manage it in the Sitefinity backend.  

But what about the developers? What are they going to do? How are they going to work with the data, customize it or integrate it into other applications? Sitefinity creates dynamic code reference for each new module that you define. Go to Module builder->Partners->Code reference. This is where you’ll find code samples for every content type that you’ve created, for all the CRUD operations, both in C# and Visual Basic, using the exact structure you defined when you created the content type, so those same fields would be available here in the code sample: the title, the company description, the related images and the related products associated with the partnership. All the code you need would be available here. In addition to that, you can define web services exposing that data over the RESTful API. You can define the scope of the service to include Partners,Products and Images, give the service a name, define the security layer and activate the service. You can now access that data directly over the API.

Related Products

Keep Exploring Videos Like This One

See More Videos