Goes through the default content types of the Article and Page that are provided in Drupal 7, and shows the similarities and differences between the two. Also goes through some of the configuration options, which define the default settings whenever a new node is created.
0:00[robotic voice] Drupalize.Me. [drupalize.me - Learn Drupal]
0:06[Content types in Drupal 7 - Intro to Fields for Site Builders, Chapter 2 with Karen Stevenson]
0:14In this chapter we're going to talk about content types in Drupal
0:17and what a content type is and what a field is
0:20and how you can put a content type on a field
0:23and exactly how all this stuff works in Drupal.
0:28So we're going to come over here now
0:29and we're going to start by looking at an empty Drupal installation.
0:34This is a brand new Drupal 7 installation.
0:36I've installed it, but I haven't done anything else to it. It's empty.
0:41We're going to see what our options are
0:44and what kind of content we can create and how we would go about doing it.
0:50I'm sitting here looking at my brand new site,
0:53and I can see that up here in the upper left-hand corner
0:55I've got this thing that says Add content and Find content.
0:59I haven't created anything yet, and I can demonstrate that if I go to Find content
1:04I find nothing because there's nothing yet.
1:07So let's see what would happen if we go to Add content.
1:11What I see is I have out of the box two kinds of content that I can create.
1:16I have an article and I have a basic page.
1:20It says articles are for time-sensitive content like news, press releases, or blog posts,
1:26and a basic page is for static content like an About Us page.
1:30So I can create these two different kinds of content.
1:33Let's just take a quick look here and see what this is going to give us.
1:37Let's say we do want to create an About Us page.
1:40Let's create a basic page.
1:43You see now I have something called a Title.
1:46If this is going to be an About Us page, I guess a title of About Us makes sense.
1:51I'm just going to insert some dummy content into that
1:55because I don't really care at this point what's in there.
1:57If I come down here, I can see I can do some things like put this page into a menu.
2:03If I click on this I can say what title do I want in the menu and where do I want it.
2:08I'm just going to leave all the defaults.
2:09It's going to default to the name of the page that I created,
2:13and it's going to put it in the main menu. That sounds good enough.
2:16I have some revision information, and I can see from this
2:20that I'm going to have some possibilities around creating new revisions of my content.
2:25I can set a path if I want to do a custom path for this.
2:30I can choose whether or not this content has comments,
2:33and for an About Us page that's turned off, which makes sense.
2:39I can see I'm going to have some information about who is the author of this content,
2:43and I've got some options about how to publish it--
2:47whether or not it's published and whether or not it's promoted to the front page.
2:51I'm just going to leave all these things at the default
2:53because right now we're just trying to kind of see what Drupal is going to do as it stands.
2:58So I'm going to save that.
3:01What Drupal does when we create content is it takes us to the page that we created.
3:05So now I have an About Us page, and it's got the content.
3:10Notice that it showed up in the tab.
3:12What that menu item did is it gave us a place in the menu.
3:16It actually shows up in this case as a tab.
3:19The tab isn't exactly where I want it.
3:21I probably don't want it showing up before the Home page.
3:24Let's see if we can fix that while we're here because I think we can.
3:29And sure enough, I have this thing called Weight,
3:31and I'm going to just give it a little bit higher weight, and I'll move it down a little
3:36so it's not at the beginning.
3:44And there we go.
3:45Now I've got an About Us page.
3:47That was pretty easy.
3:49I wonder what the other type of content is.
3:52I'm going to go back to Add content.
3:55Here's an article. Let's see what an article looks like.
3:59Okay. This is interesting.
4:01Article has some different fields on it.
4:03I have the title page that I had before, so I'm just going to call this My Article.
4:11I've got this thing called Tags. That wasn't on my other one.
4:15I can do a comma-separated, so let's say this is New, Exciting.
4:20And I can give it some dummy content.
4:26And I have a field for an image, so I could add an image here.
4:30I'm not going to do that right this minute, but I could.
4:33I've got the same options down here that I had before.
4:38I could in this case allow comments on this page if I wanted to.
4:45We'll leave that alone.
4:47Most of the other things look about the same as they looked on the other type of content,
4:51and I'm going to save that.
4:56It's going to take me to this page that it created, and here's my article.
5:01My article didn't have a place in the menu, so it's not showing up here,
5:05and that makes sense because we don't want every article to show up as a tab on our page.
5:10You can see now my article has a place where I can add comments.
5:13So I've created another kind of content--in this case an article content.
5:18It's got some fields on it that weren't on the page content type.
5:24If I go back to my Home page I'm going to see something kind of interesting,
5:28and that is now my article didn't show up in the menu but does show up on the Home page.
5:34What this is is this is what Drupal calls promoted to the front page.
5:38This article was set up to promote to the front page.
5:42So now that we see how the page and the article content type work,
5:47let's go back and see how are they actually constructed.
5:51They had different options, they had different fields.
5:55Let's talk about how we would set all that up.
5:58The way that we do that, if we look up here at the top of this administration bar
6:02across the top of the page, we have something called Structure.
6:06If I click on that, I'm going to something here that's going to say
6:11I've got some information about Blocks and Content types and Menus and Taxonomy.
6:16What I want to look at here is Content types.
6:19Here's the content types I just saw.
6:23I can see that I'm set up to do two different content types.
6:26I have an article content type and I have a page content type.
6:30I have some options over here where I can manage the fields
6:33or manage the display for these content types.
6:36We've seen what they look like. Let's take a look at what these fields look like.
6:42I'm going to go into the page first, which was my simpler content type,
6:46and you can see my page has a title and it has a body.
6:50This body is called Long text and summary,
6:52which basically just means it has an option to create a little teaser box
6:57as well as a big text area.
7:00So it's a text area with summary.
7:02I have the fields that I can put on that content type.
7:07I have some tabs up here that I can use to manage the way that that content is displayed.
7:13And I even have some tabs up here to control the way that comments would be handled
7:19if I had comments.
7:21In this case I don't have any comments on this content type.
7:25Let's go back and look at the other one, just out of curiosity.
7:28I go back to Structure, I go to Content types,
7:32and let's see what the article looks like.
7:36The article has fields, and you can see, as we noticed when we created it,
7:40we've got some extra fields on this type.
7:43Now we have a thing called Tags, which is taxonomy,
7:46which is our reference fields, and this is the place where we could put the tag list.
7:53And then we also have an Image field.
7:55Neither one of those was on the page content type.
7:59What this is showing us is that we can create any number of different kinds of content,
8:04and we can put different fields on different content types.
8:09One of the first things we want to do is try and understand what a content type is.
8:12A content type in one way is content that has different components to it,
8:19different fields to it.
8:21The page content type is a really simple content type.
8:24It only had a title and a body.
8:28An article content type was a little bit more complex,
8:32and it has a place where you can tag it, give it a reference,
8:36and it has a place where you can upload an image.
8:39So that starts to give us the idea of how content types work.
8:46There's a lot more information that we can dig into about these fields,
8:49and we're going to come back to that later,
8:51but let's take a look at some other things that we can do while we're here.
8:55Notice we've got a bread crumb up here that kind of tells us where we are
8:58in the administration area.
9:00Let's go back to the Content types page here.
9:04Again, we're back to this place where we see the two different content types that we have,
9:09and we notice that we have an edit tab for each of these content types.
9:13Let's dig into this a little bit and see what's in here.
9:18Let's talk about all the different things that are components of this.
9:22We see we have a name and then we have this thing called a machine name.
9:26Basically, this name is the name that the user is going to see.
9:31This is whatever you want your users to call this type of content.
9:36We've got this little description that tells us that.
9:38This is the human-readable name of the content type.
9:41The system is automatically going to make a nice machine name out of that,
9:46which is the name that's actually stored in the database.
9:49And then we have a description, and this is a description that we can present to the user
9:54who is about to create content type to kind of say, what type of content type would this be?
9:59Remember we saw this description before.
10:02We saw this thing that told us that articles are for time-sensitive content.
10:06This is where that description comes from.
10:10This is information that tells someone who is about to create content
10:14what type of content are they about to create.
10:17If we scroll down here a little bit more, we can see that here we had a place
10:21where we could identify what the name of the title field is.
10:24So we could say Title, which probably most of the time is the right thing,
10:28but we could call it Name or we could call it something else if we wanted to.
10:33We have some other options that we can set here.
10:35We can say Preview before submitting.
10:38What this is saying is do we want the user to be forced to do a preview
10:44before they submit the article,
10:48or do we want them to be allowed to do a preview before they submit it,
10:53or do we want to just turn that whole ability to do a preview off?
10:56So we have those three options here.
10:59And then we have again some more explanation
11:02that's going to be displayed to the user if we want to use it.
11:06In this case we don't have anything in here.
11:09We've got some publishing options.
11:13What we're setting here is a little confusing
11:18because we had the same kind of publishing options when we actually created the content.
11:21This is saying, what are the defaults going to be?
11:24What do we want these things to be by default?
11:27If somebody is creating a new article, which things do we want checked?
11:32And so in the case of an article, we want to automatically have it show up as published,
11:37and we want it to automatically show up as promoted to the front page.
11:41The person that creates the article is going to be able to uncheck those if they want to,
11:45but this is how it's going to default.
11:47We have this thing called Display settings.
11:50This is kind of interesting.
11:52This is telling us, do we want the users of the website to see the author's name
11:59and the publication date displayed on the content or not?
12:03In the case of an article, again this is defaulting to show that information.
12:09We'll go back and take a look at the other side of that in just a second,
12:13and you'll see where that shows up.
12:15And then this is the place where we can say, what are the comment settings?
12:19And again, we had this option when we actually created the article.
12:24We had an option to set up the comments.
12:27This is saying, what's the default supposed to be?
12:30Do we want to allow comments at all on this content type?
12:35And if we do, what are the default values going to be?
12:40And then we also have a place where we can say,
12:42what are the menu options for this type of content?
12:46In Drupal 7 we have several different menus.
12:49The main menu is the tabs, these things that--
12:53Well, when we get back to the Home page we'll see these tabs that show up.
12:57That's our main menu.
12:59If I go back to where I was, I had some other menu options.
13:06We have a Management menu, which is this menu up here.
13:10We have a Navigation menu, which will show up in the left-hand column.
13:14And we have a User menu,
13:16which doesn't really apply to most of the things that we're going to be doing.
13:22But we can say which of these menus are available
13:25as places that this piece of content could go.
13:29We also can say which of those is going to be the default.
13:33We saw before that we created the page content type
13:36and it went into the main menu,
13:38and the article type we didn't put into a menu at all.
13:43So now let's go back and look at that content that we created
13:46now that we've seen the backside of all this,
13:49and let's pull up the article again.
13:51Here is the article we created and here's what it looked like.
13:55If I go back and edit it, I can again say here's my title,
14:00and we know now that it says Title because in the Content settings
14:07we told it to have a label of Title.
14:11This is where that Tags field shows up that we had in our Manage Fields screen.
14:17This is where the Body field shows up that we had in our Manage Fields screen.
14:21Remember it had that funny type called Summary,
14:25and this is what the summary thing is.
14:27It gives the user an option to create a little extra teaser area,
14:32and they can either have it or not have it.
14:36It's an interesting kind of a content type.
14:39This was a filtered type of content.
14:43That means the user is going to have an option to be able to put HTML code into this.
14:49Here's the image that was added as a field.
14:52We can see here Content settings.
14:58We've got the defaults on all of these fields
15:02that are based on whatever we set up for the content type
15:06as the default for this particular type of content.
15:09If I go back again a little bit here and look at my article,
15:12remember there was that setting to say,
15:14do we want to be able to see the author's name and title?
15:18On the article we said we did, and here it is.
15:22If I go back one more step here and I look at that page that I created,
15:27I can see on the page there is no author
15:31because we did not say that we wanted the page to display the author and the date.
15:40If I look at the back end again of the page,
15:43now that I know how this got created, here's the title.
15:46I called it Title. Here it is.
15:48Here's the body.
15:50I've got this funny text and summary page type of field that they can use to create a teaser.
15:57And then I've got the menu settings.
15:59In here I wanted this page to show up in the menu.
16:04I gave it a title, I identified where in the menu it should show up,
16:11and I marked it as published.
16:14So now I've gone all the way around.
16:17I've been able to get a good chance to see what's available in my content.
16:20There's one more place that the content type affects things,
16:24and that is in Permissions.
16:27This is another reason why you might choose one type of content type over another.
16:30If I go to the People page here,
16:33this gives me all the information about my users.
16:36I have a tab called Permissions that shows me what my users have permission to do.
16:42If I scroll down here a little bit, I'm going to see some permissions related to content types.
16:48For every type of content that I create I've got some permissions that are associated with it.
16:56I have two content types. I have basic page and article.
16:59Each one of them comes with permission:
17:01who can create it, who can edit it, who can delete it.
17:06And you can see Create new content, Edit their own content, Edit any content.
17:12So for instance, you might have an editor that can edit anybody's article
17:16and everybody else can only edit their own articles or whatever.
17:20And then for each role that you have you can check or uncheck
17:24who has permission to do what.
17:27We can see from this that we've got one other reason
17:29why we might choose one kind of content over another,
17:32and that is because perhaps we want an article to have different permissions
17:36than a basic page does.
17:38So maybe only the site administrator can create pages,
17:42but any authenticated user can create articles.
17:48So there's a lot of interesting things that you can do with content types in Drupal.
17:53I'm going to go back one more time.
17:55We got to Structure, Content types, and this is kind of the main place that we want to go
18:00any time we're dealing with content types and the way that they're configured.
18:06There are a lot of different things that we can do with content types in Drupal.
18:10We can use different fields on them;
18:15we can put different permissions on one content type or another;
18:19we can group them differently in views;
18:23some have comments, some don't;
18:26some are in menus, some are not;
18:28some display information about the author, some do not.
18:32This gives you a sense of the ways that one content type is different from another
18:37or can be different from another in Drupal.
18:43[robotic voice] Drupalize.Me. [drupalize.me - Learn Drupal]