Drupal/C2/Creating-New-Content-Types/English
Title of Script: Creating New Content Types
Author: Gautam Narayanan
Keywords: video tutorial, drupal, creating new content, adding fields, events content type, user group content type
|
|
Slide 1:
Creating New Content Types |
Welcome to the Spoken tutorial on Creating New Content Types. |
Slide 2:
|
In this tutorial,we will learn about
|
Slide 3:
System requirement
|
To record this tutorial, I am using
You can use any web browser as per your choice. |
Let us open our website which we created earlier. |
Part 1 | |
Time | Narration |
0:05 | Now that we know what are built-in Content types. Let us create some custom Content types. |
0:11 | Recall the introduction to Content type. |
0:14 | We had learnt not to stuff everything into the body. |
0:18 | We are now going to learn how to create custom Content type. |
0:22 | We will create an Events Content type that tracks all the Drupal events around the world. |
Highlight row | First, let us design on a paper what fields we need to capture for this Content type.
The Event Name can be the Title field to identify this event uniquely. Event Description can be the Body field to provide some plain text description. An Event Logo is an Image to display any special logo of the event. We need a Event Date of type Date which captures the start and end date of the event. The event can have a separate Event Website which is an URL link to be displayed in this Content type. We will cover only these five fields in this tutorial. Later, we will learn to include two more fields.
User Group is another Content type we will create in the next tutorial.
|
0:39 | Now let us click on Structure and then on Content types. |
0:49 | These are our 2 basic Content types. |
0:51 | Click the blue button Add content type. |
0:56 | We are going to call our new Content type as Events. |
1:00 | And in the Description, we will type -
This is where we track all the Drupal events from around the world. |
1:11 | You can type any text that you want here. |
1:13 | This Description will appear on the Content type page. |
1:18 | You will also notice that Drupal gave it a Machine name. |
1:20 | Here we can see it named as events. |
1:24 | The Machine name is basically the name of the table in the database that Drupal assigns the content to. |
1:31 | In the Submission form settings, change the word Title to Event Name. |
1:39 | On the Publishing options, let's put a checkmark on Create new revision. |
1:44 | This means every time a node is edited, a new version will be created. |
1:51 | Leave the other settings as they are. |
1:54 | Let's turn off the Display author and date information. |
1:57 | It's not important for this one. |
2:00 | Here is something that is recommended for every Content type. |
2:04 | Click on Menu settings. |
2:07 | Under Available menus, uncheck all the menus that might be checked. |
2:12 | This will prevent a content editor from adding a thousand events to our menu structure. |
2:20 | It ensures that others don’t have the permissions to add an event to our menu item. |
2:28 | If we want to add an event later on, we can do it manually ourselves. |
2:32 | Click on Save and manage fields. |
2:34 | Once our Events Content type is saved, we will see the Body field. |
2:39 | Click on Edit on the right hand side. |
2:42 | And let's change the Label to Event Description. |
2:52 | Click on Save settings button at the bottom. |
2:56 | We have just created our first Custom Content type in Drupal. |
3:01 | It is pretty limited at this point. |
3:03 | Basically a Title and Body, which is the same as the basic page. |
3:07 | Next, we will add many more fields according to our paper design and make this a lot more helpful. |
Part 2 | |
Time | Narration |
0:39 | Click on Add field button at the top. |
0:42 | In Select a field type dropdown, choose Image.
|
0:51 | Click Save and continue. |
0:56 | We can upload a default image here, if we want to, by clicking on the Choose file button. |
1:04 | We could also add default Alternative text, if we want to. |
1:08 | We will keep the limit as one logo for each event. |
1:11 | Click Save field settings. |
1:15 | Now, we get to set up all the settings for the Event logo field. |
1:20 | Most of these are contextual and are based on the field type. |
1:24 | We can add some help text or some instructions here, for our content editors. |
1:29 | We can also check the box for Required field.
|
1:38 | We can change the file extensions that are allowed here.
|
1:46 | The file directory is filled in with a year and month, by default.
For example, you may have several Content types with images. Then, you can add a prefix events so that all the images of Events Content type will be in one file directory. |
1:53 | Drupal allows us to name it as anything that we want. |
1:56 | But be careful with this because we can not change this very easily later. |
2:01 | We can also set the Maximum and Minimum image resolution and a Maximum upload size. |
2:07 | Think carefully before you make changes here. |
2:29 | Imagine - you upload 2 or 3 megapixel images.
|
2:37 | Drupal still loads that 2 megapixel image and that can be really frustrating. |
2:45 | It gets worse if they are using their mobile.
|
2:57 | We must make sure that we are getting our images set properly before we upload them. |
3:04 |
|
3:09 | Minimum Image resolution, in particular, is very important. |
3:12 | This field should not be smaller than the largest image size that you want to display. |
3:19 | This will prevent Drupal from scaling the image beyond the original and making them pixelated. |
3:27 | Setup your Maximum Image resolution to, say, 1000 x 1000 |
3:33 | Setup your Minimum Image resolution to, say, 100 x 100 |
3:39 | Then make the Maximum upload size to 80 kb. |
3:43 | What Drupal will do is
|
3:51 | If it can't, then Drupal will reject the image. |
3:56 | It will be better to make this 600 by 600 pixels, which is a more reasonable size. |
4:02 | We will check the Enable Alt field and Alt field required checkboxes. |
4:08 | Then click Save settings. |
4:10 | Now we have an Event Logo field for our Content type. |
4:14 | Let's add another field by clicking Add field. |
4:20 | In the Add a new field dropdown, choose Link.
|
4:30 | Click Save and continue. |
4:32 | Immediately, we are prompted to specify the Allowed number of values.
|
4:35 | Once again this screen gives us the contextual settings for our Link field. |
4:44 | Under Allowed Link type, we have the options
|
4:52 | Next, we can specify whether we are going to make Allow link text as Disabled, Optional or Required. |
5:05 | We will leave this as Optional for now and see how that works. |
5:09 | Go ahead and click Save settings. |
5:13 | Once again click Add field. |
5:15 | This time we will choose the Date field. |
5:20 | Type the Label as Event Date. |
5:23 | Click Save and continue. |
5:27 | We will leave the value at 1, for now.
|
5:34 | Click Save field settings. |
5:38 | Once again we get the contextual settings page.
|
5:48 | Click Save settings. |
5:50 | Now we have two more fields to add here but we cannot add them yet. |
6:07 | We will cover those in the upcoming tutorials.
|
Slide 4:
Summary
|
Let us summarize.
|
Slide 5:
Acknowledgement
|
This video is
|
Slide 6:
Acknowledgement
|
The video at this link summarises the Spoken Tutorial project.
|
Slide 7:
Spoken Tutorial Workshops |
The Spoken Tutorial Project Team conducts workshops and gives certificates.
|
Slide 8:
Acknowledgement
|
Spoken Tutorial Project is funded by
Government of India. |
This is Gautam Narayanan signing off.
|