Drupal/C2/Creating-New-Content-Types/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Welcome to the Spoken tutorial on Creating New Content Types.
00:06 In this tutorial, we will learn about:

Creating a new Content type and Adding fields to Content type.

00:15 To record this tutorial, I am using:

Ubuntu Operating System Drupal 8 and Firefox web browser. You can use any web browser as per your choice.

00:29 Let us open our website which we created earlier.
00:34 Now that we know what are built-in Content types, let us create some custom Content types.
00:41 Recall the introduction to Content type.
00:45 We had learnt not to stuff everything into the body.
00:49 We are now going to learn how to create custom Content type.
00:55 We will create an Events Content type that tracks all the Drupal events around the world.
01:02 First, let us design on a paper what fields we need to capture for this Content type.
01:09 It is a good practice to do this for all new Content types before creating it in Drupal.
01:16 Create a table with columns for Field Name, Field Type, and Purpose.
01:23 All Drupal nodes have Title and Body fields defined, by default.
01:29 The Event Name can be the Title field to identify this event uniquely.
01:36 Event Description can be the Body field to provide some plain text description.
01:43 An Event Logo is an Image to display any special logo of the event.
01:50 We need a Event Date of type Date which captures the start and end date of the event.
01:58 The event can have a separate Event Website which is an URL link to be displayed in this Content type.
02:07 We will cover only these five fields in this tutorial. Later, we will learn to include two more fields.
02:17 Every event will be sponsored by an User Group. User Group is another Content type, we will create in the next tutorial.
02:27 Two nodes of two different Content types are linked in Drupal using the Entity Reference field.
02:35 An Event Topic is a Taxonomy field which is used to categorize the event under various keywords.
02:44 Now, let us click on Structure and then on Content types.
02:50 These are our 2 basic Content types.
02:53 Click the blue button Add content type.
02:57 We are going to call our new Content type as "Events".
03:02 And in the Description, we will type -"This is where we track all the Drupal events from around the world".
03:11 You can type any text that you want here.
03:15 This Description will appear on the Content type page.
03:20 You will also notice that Drupal gave it a Machine name. Here we can see it named as "events".
03:28 The Machine name is basically the name of the table in the database that Drupal assigns the content to.
03:36 In the Submission form settings, change the word Title to Event Name.
03:43 On the Publishing options, let's put a check-mark on Create new revision.
03:49 This means every time a node is edited, a new version will be created.
03:55 Leave the other settings as they are. Let's turn off the Display author and date information.
04:02 It's not important for this one. Here is something that is recommended for every Content type.
04:09 Click on Menu settings. Under Available menus, uncheck all the menus that might be checked.
04:17 This will prevent a content editor from adding a thousand events to our menu structure.
04:24 It ensures that others don’t have the permissions to add an event to our menu item.
04:31 If we want to add an event later on, we can do it manually ourselves.
04:37 Click on Save and manage fields.
04:40 Once our Events Content type is saved, we will see the Body field.
04:45 Click on Edit on the right hand side. And let's change the Label to "Event Description".
04:55 Click on Save settings button at the bottom.
04:59 We have just created our first Custom Content type in Drupal.
05:04 It is pretty limited at this point. Basically a Title and Body, which is the same as the basic page.
05:13 Next, we will add many more fields according to our paper design and make this a lot more helpful.
05:23 Click on Add field button at the top.
05:27 In Select a field type drop-down, choose Image. In the Label field, type "Event Logo".
05:36 Click Save and continue.
05:39 We can upload a default image here, if we want to, by clicking on the Choose file button.
05:48 We could also add default Alternative text, if we want to.
05:54 We will keep the limit as one logo for each event. Click Save field settings.
06:02 Now, we get to set up all the settings for the Event logo field.
06:07 Most of these are contextual and are based on the field type.
06:11 We can add some help text or some instructions here, for our content editors.
06:18 We can also check the box for Required field which means that a content item or node cannot be saved, until an event logo is added.
06:30 We can change the file extensions that are allowed here. It is recommended not to add bitmap here.
06:38 The file directory is filled in with a year and month, by default. But we can change this, if required.
06:47 For example, you may have several Content types with images.
06:53 Then, you can add a prefix events so that all the images of Events Content type will be in one file directory.
07:04 Drupal allows us to name it as anything that we want. But be careful with this because we can not change this very easily later.
07:14 We can also set the Maximum and Minimum image resolution and a Maximum upload size.
07:21 Think carefully before you make changes here. Imagine - you upload 2 or 3 megapixel images.
07:28 You use your wysiwyg editor. Shrink it down to a few hundred pixels.
07:35 Drupal still loads that 2 megapixel image and that can be really frustrating.
07:41 It gets worse if they are using their mobile. And on the data plan, suddenly you made them download 2 megabytes that they didn't need to download.
07:51 We must make sure that we are getting our images set properly before we upload them.
07:57 What's the largest size the image should be and what's the smallest size the image should be?
08:03 Minimum Image resolution, in particular, is very important.
08:08 This field should not be smaller than the largest image size that you want to display.
08:14 This will prevent Drupal from scaling the image beyond the original and making them pixelated.
08:21 Setup your Maximum Image resolution to, say, 1000 x 1000.
08:26 Setup your Minimum Image resolution to, say, 100 x 100.
08:31 Then make the Maximum upload size to 80 kb.
08:36 What Drupal will do is shrink the image down to a 1000 by 1000 size and make it 80 kilo bytes.
08:44 And, if it can't, then Drupal will reject the image.
08:48 It will be better to make this 600 by 600 pixels which is a more reasonable size.
08:56 We will check the Enable Alt field and Alt field required check-boxes.
09:02 Then click Save settings.
09:05 Now we have an Event Logo field for our Content type.
09:09 Let's add another field by clicking Add field.
09:12 In the Add a new field drop-down, choose Link. In Label field, let’s type "Event Website".
09:22 Click Save and continue.
09:25 Immediately, we are prompted to specify the Allowed number of values. We will just have 1 value for that.
09:34 Click Save Field Settings. Once again, this screen gives us the contextual settings for our Link field.
09:43 Under Allowed Link type, we have the options

Internal links only External links only and Both internal and external links.

09:54 Next, we can specify whether we are going to make Allow link text as Disabled, Optional or Required.
10:04 We will leave this as Optional for now and see how that works.
10:09 Go ahead and click Save settings. Once again click Add field.
10:15 This time we will choose the Date field.
10:20 Type the Label as "Event Date".
10:24 Click Save and continue.
10:26 We will leave the value at 1, for now. In the Date type drop-down, choose Date only option.
10:34 Click Save field settings. Once again we get the contextual settings page.
10:43 Here, let’s change the Default date to Current date.
10:47 Click Save settings.
10:49 Now, we have two more fields to add here but we cannot add them yet.
10:55 We will cover those in the upcoming tutorials. With this we come to the end of this tutorial.
11:03 Let us summarize. In this tutorial, we have learnt about creating a new Content type and adding fields to Content type.
11:28 This video is adapted from Acquia and OSTraining and revised by Spoken Tutorial Project, IIT Bombay.
11:39 The video at this link summarizes the Spoken Tutorial project. Please download and watch it.
11:46 The Spoken Tutorial Project team conducts workshops and gives certificates. For more details, please write to us.
11:55 Spoken Tutorial Project is funded by NMEICT, Ministry of Human Resource Development and

NVLI, Ministry of Culture, Government of India.

12:09 This is Gautam Narayanan, signing off. Thanks for joining.

Contributors and Content Editors

Nancyvarkey, Pratik kamble, Sandhya.np14