Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating and managing content types

From: Drupal Gardens Essential Training

Video: Creating and managing content types

As we discussed in the video "Creating and Managing content," Drupal stores all content as nodes. News items and blog post are simply different kinds of nodes, and these are called content types. Three things set content types apart from each other. First and most obviously, is their identity-- that is, all news items are categorized as news items. The shared identities that nodes have within a content type means that they can be gathered together using views. You will learn more about that in the video later in this course about creating dynamic pages with simple views.

Creating and managing content types

As we discussed in the video "Creating and Managing content," Drupal stores all content as nodes. News items and blog post are simply different kinds of nodes, and these are called content types. Three things set content types apart from each other. First and most obviously, is their identity-- that is, all news items are categorized as news items. The shared identities that nodes have within a content type means that they can be gathered together using views. You will learn more about that in the video later in this course about creating dynamic pages with simple views.

The second thing that sets one content type apart from another is how they collect and hold different bits of information, called fields. So a content type called customer might have a field for phone numbers, for example, and another field for contact preferences. Then when you create a node of that customer content type, you have place to put those little bites of information. Lastly, content types vary in how they display that information. This video will show you how to create a content type, add fields to it, and change the way they are displayed.

The campaign template that we are using in this Drupal Gardens site comes with six of those content types already built in, and I'll show you how to create another one. But first, let's take a look at those six content types. To do so, we go to Structure and Content types. Each one of these lines is a different content type, and their name should look familiar to you from when you create content in a previous video. Next to each content type's name are four links to edit and delete the content types, and then manage the fields that are in them, and manage the display of those fields.

Very quickly, I am just going to show you one of those content types, Basic page. If we click on manage fields, we see that it only has two: Title and Body. If we click Add content and then a node of that Basic page content type, you see Title and Body, and that's all, and that pretty much gives an overview of how content types relate to nodes. What we are going to do now is go back and create our own content type. Since this site is about exploring California, I am going to create one called "Tour." I do that by clicking Add content type then typing in the name, "Tour." You can also add a description.

Now this only shows up when somebody creates a node of that content type. It doesn't actually appear before ordinary users of the site. I am going just to add something here so it's clear to somebody who wants to create a Tour node. I'll say, "A tour package we offer." Down at the bottom of the page, we have quite a few options underneath these vertical tabs. I am not going to go through all of them. The most important one is the Publishing options. In this case, I don't want each node of the Tour content type promoted to the front page, so I am going to turn that off.

I do, however, want it to create a new revision each time we create a tour. That way if somebody edits it, I can go back and see what exactly they edited. Another thing I am going to change is I want to turn off comments. I don't want people actually commenting on our tours, so I'll change the Comment setting from Open to Hidden. If you would like to learn more about these vertical tabs, watch my course on lynda.com "Drupal Essential Training," where I go into them in greater detail. But for right now I am just going to go down to the bottom of the page and say Save content type.

That brings us back to our page of content types, and if you scroll down, you'll see, there it is: Tour. We can actually add content to that Tour content type right now by just going up to the Add content and Tour, but I am going to add a few fields. I am going to add three of them, specifically. One will show how many days the tour is. The second will be how much the tour costs, its price. And the third will be an image, so the people can get a sense of exactly what they are paying for. To do that I'll go down to Tour and click manage fields. By default, content type have two fields in them, just like you saw on Basic page: Title and Body.

I am going to add a new one, which will be called "Length." I add the label there, and then I add the name of the filed. Now this has to be all lowercase or numbers or underscores. This is what the computer itself understands. So it will be length, lowercase. And then I have choice of what type of field. In this case, I want people to say 1, 2 or 3 days, not 6.57. So I make it an integer. These other field types have different options attached to them. The best way to understand them is to just start playing around with them: add fields to content types, see what options you get, and learn how they work. But for now, we'll just stick with Integer.

We only have one option for how to enter integers, which is text field, and so we add that, and just click Save. We now get two screens of settings. The first one is how that field will appear in every content type. Once you have added a field, you see, it doesn't only have to be in the Tour content type; we could then add the same kind of field to the basic page or blog post or whatever. In this case, there are no special fields settings to appear in all content types, so I'll just say Save, and that just bring us to our page for the Length field only in the Tour content type, and here you have a lot more options.

I am going to make this required. I'll add a little Help text here, "How many days is this tour," and I'll add a suffix. Now I want to say it's 1 day or 2 days or 3 days. If I were to just type "days" here, it would always say 1 days instead of just 1 day. Fortunately, Drupal Gardens allows you to add a conditional to it. So day, pipe--that little vertical line-- days tells it if you want it to be 1, it's day and multiple is days.

All of that just described here. Now I know this is getting into a little bit of detail, more detail than perhaps you would need for every one of the fields you enter, but this is just to show you some of the many options that Drupal Garden offers you when you create a field. If you have any problems, the first thing to do is look at the Help text directly underneath the field, and you will usually find that it takes care of whatever it is you need to figure out. Scroll down and click Save Settings. There is our Length field. I am going to quickly add the other two. The first one is Price. That will also be an integer, a number of dollars, and save it. Continue on.

I'll also make that required. And as a prefix, I'll add a Dollar sign. Good. Finally, I'll add a different kind of field, a photo of what the tour is going to look like. So Photo is in Label, and photo is the name. Field type in this case is going to be Image. We only have the choice of Image, and save. Now here we get a setting that will apply to the Image field everywhere that it is used. It's a default image; what will appear if people don't add there own? I am going to use one of the files from our exercise files, which you received if you are a premium lynda.com subscriber, or you got this course on a disc.

I click Browse, navigate to it, in this case its in our exercise files, and default-tour-pick, Open and Upload. Great! Once that little animation is done, that means that file is uploaded. So I Save field settings, continue on, and I am not going to change any of the options here, and say Save settings. We now have our Tour content type with these three custom fields. The last thing I'll do is I will put them into an order I want.

I want the Length and Price to be above the Body and the photo to be below it. I will move those into there places by dragging on this little compass-like icon, scroll to the bottom of the page, and click Save. There we go. Now we are ready to start creating Tour content. To do that, you already know how: just go up to Add content and Tour. Now you can see that this is different from Basic page because you have this Length and Price, and down at the bottom, Photo, just as what you expected. I will fill this with a little bit of sample content.

I call it "Big Sur Retreat," the Length will be 3 days, the Price will be $350, and for the Body I get that from the text that came with the exercise files. I have that here on my Desktop. Just copy it, paste it back into our site, and I'll add my photo, again from our exercise files. Upload, and save. There we go. We have created this node, and it has, just as we expected, a photo, a length, and a price.

There are a few things that I want to change on this node, however. One is I don't think we need the "Photo" above the photo, since obviously that's what it is. The other thing is up toward the top here, we have the Submitted by and the person's name and date. We don't really need that information either. We can change both of those by editing the content type. To do so, once again, we go to Structure and then Content types and down to Tour. Now the Photo is a field, so we would change that by managing either the field or its display.

As it happens, the way that you change a label is by managing its display. I click there and go to the Photo field right here. The Label instead of appearing above, will just be hidden. Scroll down and save. The other part to change, which is whether or not the author and date information appears, is part of the content type in general. So we go back and edit the content type as a whole. As we scroll down, we see this option here, Display settings. I'll just go into there and uncheck Display author and date information, and Save content type.

One thing about changing a content type is it changes all of the existing nodes when you change, for example, how images are displayed or whether labels are displayed. That's actually a good thing because it makes your whole site stay consistent. Let's close out this overlay and see if it works. The page reloads. There. That author and date information is gone, and as we scroll down, the word "Photo" is gone. So everything is great. Now you saw how to modify a content type that you created, but you can also use these techniques to modify those built- in content types, such as Blog or Basic page, and there is lot more you can do with the display options.

I didn't even show you half of it. If you are curious about that, check out my Drupal Essential Training course as well, which is also on lynda.com.

Show transcript

This video is part of

Image for Drupal Gardens Essential Training
Drupal Gardens Essential Training

65 video lessons · 11850 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 29m 56s
    1. Welcome
      1m 39s
    2. Previewing the finished project
      1m 29s
    3. What's new in the late 2011 update?
      5m 28s
    4. What is Drupal?
      5m 8s
    5. What is Drupal Gardens?
      5m 57s
    6. Getting started with Drupal Gardens
      5m 35s
    7. Getting help
      4m 1s
    8. Using the exercise files
      39s
  2. 17m 40s
    1. Using the administrative overlay
      2m 54s
    2. Using the dashboard, toolbar, and shortcut bar
      5m 36s
    3. Touring the newly created site
      3m 55s
    4. Configuring the site
      5m 15s
  3. 59m 47s
    1. Creating and managing content
      11m 11s
    2. Creating and managing content types
      10m 35s
    3. Embedding YouTube videos and other media
      4m 5s
    4. Subscribing to RSS feeds
      4m 49s
    5. Categorizing RSS feeds
      5m 1s
    6. Managing tags and taxonomies
      5m 50s
    7. Creating dynamic pages with simple views
      4m 29s
    8. Creating complex information collections with Views
      8m 59s
    9. Creating image galleries
      4m 48s
  4. 37m 50s
    1. Working with blocks
      10m 26s
    2. Setting up rotating banners
      7m 45s
    3. Understanding menus
      7m 27s
    4. Setting up contact forms
      7m 7s
    5. Adding and removing functionality
      5m 5s
  5. 54m 54s
    1. Managing users
      6m 28s
    2. Adjusting user permissions
      6m 35s
    3. Managing comments
      7m 7s
    4. Slowing spam
      5m 20s
    5. Starting discussion forums
      9m 3s
    6. Creating blogs
      4m 41s
    7. Setting up mailing lists
      4m 50s
    8. Allowing users to rate content
      4m 21s
    9. Using best practices for online clubs
      6m 29s
  6. 44m 35s
    1. Getting feedback with webforms
      6m 14s
    2. Publishing RSS feeds
      6m 40s
    3. Taking advantage of social media
      9m 33s
    4. Emphasizing external links
      2m 44s
    5. Improving search engine optimization (SEO)
      7m 30s
    6. Internationalizing sites
      8m 6s
    7. Tracking site usage with Google Analytics
      3m 48s
  7. 34m 40s
    1. Understanding Drupal themes
      5m 44s
    2. Understanding the Theme Builder
      5m 25s
    3. Switching, saving, and copying themes
      7m 13s
    4. Introducing custom CSS
      6m 51s
    5. Refining selections in the Theme Builder
      5m 48s
    6. Exporting themes
      3m 39s
  8. 48m 31s
    1. Changing the site's color palette
      2m 32s
    2. Changing the site's main logo and favicon
      5m 22s
    3. Changing the column number and arrangement
      5m 7s
    4. Adding background colors and images
      6m 29s
    5. Changing element spacing and borders
      6m 11s
    6. Adjusting typography
      4m 24s
    7. Using fonts from outside sources
      5m 7s
    8. Inserting raw CSS code into themes
      6m 57s
    9. Adding visual effects with JavaScript libraries
      6m 22s
  9. 14m 18s
    1. Finessing theme design
      7m 51s
    2. Eight ideas for modifying themes
      6m 27s
  10. 23m 38s
    1. Monitoring sites
      4m 11s
    2. Duplicating and deleting sites
      4m 23s
    3. Adding custom domains
      3m 48s
    4. Using exported sites outside of Drupal Gardens
      3m 46s
    5. Hosting exported Drupal Gardens sites
      7m 30s
  11. 51s
    1. Goodbye
      51s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal Gardens Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.