Drupal 8 Site Building: Content types and Fields

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hi everyone, Ivan from WebWash here. Around the time when Drupal 8 was released, I wrote a tutorial series on how to create a blog using Drupal 8. And in the series, I cover all sorts of stuff such as content types, fields, blocks, menus, comments. Everything essential that a site builder should know. And if you want to go read the tutorial series, head over to the link below. But I thought, it will be good to do a video series based off these tutorials. So in this first video, I'm going to cover content types and fields. So enough of me talking, let's jump right in. So here is my brand new freshly installed Drupal 8.1 site, and in this video, we will have to do two things. First, create a content type and attach fields to it, and then create a taxonomy vocabulary. So first, let's create the content type. So to create a content type in Drupal 8, just go to structure, content types. And click on add content type. Let's call our content type blog, let's be original. And give it a description of used for posting blogs. Then under the submission form settings, I often turn off the preview because it's useless, and I also uncheck promoted to front page. Then display settings, yeah that's fine. We often want to display an author and date information and under menu settings, just uncheck this because this is only useful for the basic page. And then click on save and manage fields. Now on this content type, we're going to have a few fields. We will have a body field, image, tags, and category. Luckily for us, Drupal creates a body field whenever you create a content type. So we can reuse this one. And so we only have to add in three fields. Image, and tags, and category. So click on add field, and because we are using the standard installation profile, Drupal already created an article content type and already created an image and tags field. So let's just reuse those fields. So under reuse an existing field, select image and then click on save and continue. Leave everything as is and then click on save settings. Again click on add field. And then this time select the field underscore tags, and then down here click on tags under available vocabularies and create referenced entities if they don't already exist. This is useful because just imagine yourself you're creating a blog post and if you want to tag the blog using a term which you haven't created, you can simply enter it in from the blog content type without having to go into the taxonomy section to create that tag first. So click on save settings. Okay, now before we create the category field, let's first create the vocabulary. So go to structure, taxonomy term, and click on add vocabulary. We will call this Category, and then just click on save, and while we are here, let's just quickly create two terms. Drupal and Wordpress. Okay. So now that the category has been created, let's create the actual field. So let's go back to structure, content types, and click on manage fields on the blog row, and click on add field, and in the drop down select taxonomy term under reference. And call this Category, then click on save and continue. Leave the allowed number of values to one, because we only want to allow one category to be attached to the blog post. Click on save field settings, and make the field required and then just select Category from under available vocabularies, and click on save settings. Okay, now we have created the fields. Let's configure the widgets. So under manage form display, now this is new in Drupal 8. Previously in Drupal 7, you would manage the widget from the form edit page, if I remember correctly. But right now in Drupal 8, you have this new manage form display. So just click on manage form display. And here you can reorder the fields and configure the widgets. So what we'll do is move image above body, and move category above tags, and let's change the category widget to select list, and tags to autocomplete tags style, and click on save. Okay, now click on manage display. And here you configure the field formatters. Let's just move a few things around. So let's move image above body, and leave tags and category below the body. And let's just switch off the label for image, and click on the cogwheel on the image formatter, and let's add an actual image style. And then just click on save. Okay, so at this point we have created our content type, our vocabulary, and we have attached fields to the content type. Now let's create an actual blog post and see what it looks like. So click on content, add content, and then blog. And then just enter in a title, so test article. Upload an image, we'll just add this one in, call this Drupal icon, enter in a bunch of body text, and then from the category drop down, I can select a term so category, either Drupal or Wordpress, and from tags I can just add in random tags. So I'll add in development, and if I put in a comma I can separate it out and I'll put in front end here, so let's call this front end. And then click on save and publish. And now we can see our test article. We have the image there, we have the body field there, we have the tags, and we also have our category down here. So that's it. Thank you so much for sticking it to the end. If you enjoy what you've seen, don't forget to subscribe to our youtube channel, and also head over to webwash.net where you can read up on the latest Drupal 8 tutorials. Thank you so much for watching, and I'll catch you next time.
Info
Channel: WebWash
Views: 6,159
Rating: 4.9245281 out of 5
Keywords:
Id: tj5E-jdQehw
Channel Id: undefined
Length: 8min 24sec (504 seconds)
Published: Tue Aug 09 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.