In my previous Drupal article, I tried to explain the Content Type in Drupal. In general, Content Type is a group of fields to create a specific form for entering the specific type of information into the Drupal system. Content Type allows user to enter different types of information in Drupal.
Creating a new Content Type is not difficult but you should have understanding of different types of form fields available in Drupal. I will go into more details about different types of form fields in next article but at this time lets discuss about process of content type creation.Key steps for new Content Type in Drupal are:
Create New Content Type in Drupal
- After login into Drupal, go to structure section and then Content Types. This is the place to create and manage fields,forms and display settings of your content
- Now go to +Add content type
- Now give a unique name to your new content type
- Content type is a group of form fields for saving specific type of information into database and displaying same thing for users. So you need to enter form submission settings like Title field name, preview before submission. Title is a essential field in all content type.Similarly you can check publishing and display settings of this content type. You can select a particular menu to display this content type. Now save these settings and proceed.
- Your content type is created with one default Text field named body. You can keep this or remove if you dont require. In this new page you will see four tabs.
- Edit – To edit content type settings which we just created
- Manage Fields – To add, edit, delete or change settings of form fields
- Manage form display – To manage the display of form for this content type. All the included fields have specific display settings. You can hide a form field also.
- Manage display – You can change the display property of field label. When you see your saved content, labels can be displayed above or inline with the field data.
- Now you can add more fields in your content type.Go to Manage fields tab and click on +Add field.
- You will see list of available field in the Add a new field option. Fields are broadly categorized in four type
- General – General fields like Boolean, date , email etc. You can also add comments as a field.
- Numbers – Number field like integer, float etc
- Text – Text fields like plain text, long text etc
- Reference – Reference fields are fields available in other content, taxonomy, user or other Drupal system. This is most useful way to create relationship between different parts of the system. You can link a field of other part of system and create a relationship. Just see this examples of reference field
- ABCD is a school having profile data of all student. Each student has a unique ID. School display the result of student online. so there is one Content type “student result”. While entering result of each student, you can reference student name from the Student profile content. When you enter result, this referenced field will show the list of students.In this way the information is interlinked and a proper relationship is created.
- In the above example, if Student unique record is saved as user, then reference field can be selected from user.
- If result is entered into system by concerned class teacher and we expect to display display student attached in that particular class, then we may use reference user profile and get filtered class students through the view.
- If you want that names of the city should be unique and you saved them as Taxonomy term then you can reference this Taxonomy term in user location, address etc.
I hope you would have got a general idea of creating a new content type in Drupal. Creating a new content type with general fields, number or text fields is easy. But real world examples require relationships between different information in the system so you need to create reference field. Use of reference field is quite vast which i would like to discuss in detail in next articles.