Viewers: in countries Watching now:
In this course, author Tom Geller demonstrates how to use the Views module and other add-ons in Drupal to present dynamic, data-rich content. This course examines several real-world examples of effective data visualization and describes the Drupal data-storage model. The course also shows how to create, format, and style views; control access to data; improve data administration with Views Bulk Operations; and display content as custom maps and slide shows.
Our site doesn't contain very many records yet, so when I want to make a change to every record about our company's locations, for example, as I did in our last video, I can just click through and manually edit all three pretty quickly. But what about when the site gets bigger? Then I'll really want to start to have tools that will do bulk edits. Fortunately, such a tool exists for Drupal. It's called Views Bulk Operations. You can get it at drupal.org/ project/views_bulk_operations.
I'll download and install it in the usual way. I copy the link for the .GZ file, go back to my site, click Modules, and Install; Paste and Install. When that's done, I enable it. Scroll all the way down until you're in the Views group at the very bottom. Then click Views Bulk Operations. But you can't do it without the Entity Module, so we'll go and get that one as well.
That's at drupal.org/project/entity. Once again, we scroll down and install it in the usual way. Now, when we scroll all the way down, we can turn on Views Bulk Operations and Entity automatically gets turned on. Views Bulk Operations essentially lets you build your own content management page, very much like the one that you get when you click Content.
You might remember that we had earlier filtered this, so we saw only Location types. We can Reset that and show everything. We can also select several of these, make certain Update Options, Unpublish them, Delete them and so forth. There is one thing that I dislike about this page however. When we set up our employee records, we had the Title field show the Employee ID, but when I look through this list, I don't know who employee 213 is. I'd rather see them by name. So that's what we'll do with Views Bulk Operations.
To make that happen, we create a View. Go up to Structure and Views. On this page, you'll notice one of the built-in Views down here is called Content. This was added by Views Bulk Operations. I'm going to clone this and then work with the clone. I'll call it Employees by name and Continue. If we scroll down to the Preview, we see that it looks very familiar. It shows our Title, Content Type, Author, and so forth.
In fact, it looks exactly like our Content page, but it was created in View, so we can now change exactly what it does. I'll go back up to the top, and take a look at the page. I just want to see what path it is. It's /admin/content2; remember that. We'll save it, and then take a look at that page in a new tab. You'll notice once again, we have this Choose an operation, but it has a lot of other options. We can execute an arbitrary PHP script, for example, or Unpublish content depending on what keywords are in that content.
Also, there are additional options up here for filtering. This is all done with Exposed Filters which you learned about earlier in the course. What I'm going to do with this View though is I'm going to add that first and last name. So I go over and I edit the view just like I do any other view. Here, I'll add two fields; First name and Last name. Type name to find them, there is Family name and First name, and add them and configure them. Just for speed, I'll accept the defaults.
If we scroll down to the Preview area, we see how that looks, and actually it's not bad. Now, we see it by Family name and First name instead of just by number, but we can do a little better. First, let's reorder those, and again, this is using things that you saw earlier in the course. We'll go up here to Rearrange and drag First name and Family name back up to the top and Apply. We can also rewrite this so that First name and Family name are altogether in one field.
We click Family name, Rewrite the Results, Rewrite the output, then take a look at our Replacement Patterns. We want field_first_name followed by field_last_name and Apply. Then we'll scroll down and take a look, and we can get rid of this First name. We'll simply hide it from the View, and Apply.
So it looks pretty good. But we still have this title here that isn't really necessary when we're looking at employees. In fact, we want this to just be a list of employees. So first, I'll add a filter to get rid of the other node types, and then I'll find a way to link this, and get rid of this title. So let's go up and change the Type filter. Make it so that it's not exposed and that it shows only Employees and Apply. When you scroll down, yup! Showing just Employees, and as we do that, we don't need to show the Type.
So I'll scroll up to the Filter, and remove the Type. Looks pretty good! Now, let's change that link, and then we're just about done. To do that, we'll have to add a field called Link. Go up to Fields>Add and do a search for link. There it is! And Add and Apply. I'll move that up to the top, and apply once again and see how that looks. That's not bad.
If we continue to play with this View, we could, for example, make this Family name linked to the record instead of having a View link, but let's leave it as it is for now after getting rid of the title since it's now redundant. Go to Title, and Remove. Just for safety, we'll go up and save it. I'm going to do one more thing. I want to change what operations are available from this menu, and that's part of Views Bulk Operations. We go up and edit the view, and then we scroll down to Fields, because the place that those control shows up is in Bulk Operations.
Click it to edit, and then scroll down. Here, we see that we have a lot of operations available to us, and as you add more modules, additional operations might become available as well. For each of these, you have several options. Again, I won't have time to show you those now, but I recommend that you play with them just to get it exactly the way you want. Let's add one, for example, Display a message to the user, and then Apply.
We'll go up and save. So now we're back at that view. We take a look at our operations and we have that Display a message to the user that we had selected before. Let's say that we just selected this one and said Execute. Now, we can decide what sort of message would be shown to the user. You get the idea. This is quite extensible. In fact, it is possible to add your own custom operations to that list. There are a few ways of doing that. If you're a developer, you can write plugins for Views Bulk Operations.
But for those of us who aren't developers, there are some options in the form of a compatible module that takes advantage of Views Bulk Operations. If we go back to the Project page, we see this group of Complementary Modules. All of these work together with Views Bulk Operations to let you change what you can do to those items on that content page. Now I know that I went through that fairly quickly, it's just because there are so many options with Views Bulk Operations.
I like its basic setup, without much customization at all, but of course you could go very far with it. One example would be to show all of the employees' photos on that Content Management page. A more complex example would be to show only those employees who have a birthday coming up in the next week, and then you could set a bulk operation to email them a birthday greeting. Remember, anything you can do in a View, you can do in a Views Bulk Operations page. The only difference is that with Views Bulk Operations, you can change the records that are displayed in that View.
There are currently no FAQs about Drupal 7: Reporting and Visualizing Data.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.