Drupal Tutorials #26 - Views - Fields

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up this is Scott with level up tuts and today I'm gonna be going over some more Drupal views we're going to be talking about fields how you can add them how you can change them and some of the cool stuff you can do well this is just going to be a basic overview of fields we'll get into more later in a few coming tutorials for a little bit more advanced functionality but for now I'm just going to show you how to use fields how to add them and we know just what you can do but before we get started I wanted to give a quick shout out to Michael McMillan who designed this awesome logo for us as you can see we have an actual logo now which is which is cool and Mike did a great job on it so I would suggest checking out his site which is a Michael P McMillan com you know he's a really good guy great great designer and he's a very talented developer as well so with that let's get started in views so I'm just going to access my view that we were working on before which we just called test view if you have your home page up or wherever you have your view up and you're not in the Edit screen you can always click on the gear and then click Edit view and this will take you into your view so if you notice right here in this column we have fields and right now it's just content title if we look down at what's being displayed it's just our content title well let's spice this up let's add something a little bit different here right now we're looking for articles that are published well what other things do these articles have let's actually open it up in a new tab our content types so we can look at the other content fields that our articles have so let's go to manage fields and if you remember we had a body we had tags with an image we had an insert image URL path settings whatever lots of stuff here so let's bring in the body so if we go back to review if you want to click add and this button next to your fields it'll pop up with this menu we can use the search bar or we can just look as you can see content body is right here so all we have to do is select this and if you'll notice it says actually where this content is located in so if you have any doubts or you have some fields that are named something similar this is a nice way to say okay the content body appears in a page article the project and a webform so let's look at one like insert image only is in note article or something like content link which actually isn't one of your fields this is the actual link to the specific content that you're pulling in so there's all sorts of things in here other than just your fields you know we have a Content link we can bring in the note ID if you remember your note is your piece of content you can bring in new comments the post date so let's bring in the post date as well just so we have something else here and one more let's actually bring in the content type just for fun so we can see a couple of different things and we'll click apply all displays you'll notice it'll take us to some other menus but let me just explain this all displays first you could have different views that are set up without very similar things and if you keep adding different blocks or different pages to your same view it's going to retain all of the fields and the filters but if you want to change them a little bit you can change them without changing all of them so if you'll notice right here when we're adding it says apply to all displays so right now if we add this and we have multiple views it's going to be added to all of them so let's just click apply now we'll go over more of the over writing and stuff like that later for now know that just this is going to be able to add to multiple blocks or pages in your view so we don't want to label let's click out of that I actually don't know you know I don't even use label that often I don't know why that's selected by default but it is so that's one of those things has just got to live with with Drupal and this exclude from display is going to make this field hidden which can be useful if you're rewriting it or you're using a custom field where you can use replacement patterns to bring this information back in here so this exclude from display is actually pretty useful however I'll go over that in the more advanced section on fields and we just won't worry about that right now because this is just our content body you know I actually want this to be a summary or trimmed because I you know I don't want all this text in here so we're actually going to trim this to just 100 just so you can see that it brings it in and then we don't have to worry about all the text although I don't remember ever putting in that much text in these examples so down here we have a couple more things we have style settings so you can customize things you can customize the label the HTML you can customize the field customize label and wrapper in HTML you can add a default class or by default it adds the default classes or you can use a field template we're just going to leave these as default for now and this no results behavior this is what happens if you have a field that doesn't have any information in it so by default hide rewriting if empty so basically if there's no content it's not going to show anything although you could have it display something like there is no content or pretty much anything you want so let's go down here let's close this one and let's look at the rewrite results so rewrite results are sort of some extra things you can do if you want to rewrite the output of this field you can check this and it's going to override the output you can use things like a replacement tokens or custom text it's you know it's really useful and I'll get into that more in the Advanced section on fields I just wouldn't worry about that right now if you want you can output this field as a link if you check this it's going to ask you for the link path so you could actually set this to link to the content if you wanted to and so that might be useful if you have a title and you wanted to link it to the content or if you have an image you mean basically anything that you want to link is it's very useful you can trim this field to a maximum length we're sort of already doing that with this summary or trimmed remove white space you can convert new lines in HTML to break tags I'm just going to leave those as is here right now and then more you can give this an administrative title which is sort of nice if you have lots of things let's say you're bringing in lots of fields and some of the names are pretty similar if you give this an administrative title it's just going to make it easier to manage in your view so this click sort column we're not going to worry about this either for right now so let's just unclick this and we're going to add to all displays so that was our content body now we're going to do the same thing for our post date you know we'll leave a label for this one just so you can see what happens it's going to place a colon after it because I like that the date format we're going to set it to short format however you know Drupal comes with all of these built in and in a later lesson I'll show you how to customize and create your own date formats but for now we'll just pick one that's built in these will all be the same style settings no results behavior we're just going to leave these as is add to all displays and then the type we're also going to keep a label on this one and just click all displays okay so let's check this out so now as you can see there's some sort of broken image in here we're not going to worry about that right now I think that's the image that's in the body for our text it's just probably not showing up in this view here in the preview we have our title we have our body text we have our post date and we have our type article so let's just save this and look at it on the page okay so there's clearly something wrong with this image link that's no big deal right now I'll have to go through and see what's going on there but as you can see it's brought in the title the body text the post date and everything so if we wanted to put this block somewhere else let's put it in the main content and save this you can see how this will adapt now it's in the main content you can see you can get started building some really interesting stuff so once you start styling this content with your CSS you'll be able to see how absolutely versatile this is you can pretty much bring in any content in any pieces of this content that you want and just throw it on your page so that's how you add a field to your view in the next lesson we're going to be talking about some format things some pagers and we'll get back to the advanced functionality of fields after we've gone over some of the more basics of views that way once we get into the advanced stuff it might all sink in a little bit better and make a little bit more sense once again this is Scott with level up tuts and thanks for watching
Info
Channel: LevelUpTuts
Views: 35,695
Rating: 4.9652176 out of 5
Keywords: Drupal, Tutorial, software, tutorial, Data, Technology, Business, System, Management, Training, Systems, Information, Computer, Design, Using, xampp, drupal7, installing, level, up, tuts
Id: 73TgB1JcRWY
Channel Id: undefined
Length: 8min 45sec (525 seconds)
Published: Fri Apr 20 2012
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.