Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
by
Lessons:33Length:3.7 hours
Drupal 8 1
  • Overview
  • Transcript

5.11 Creating the Upcoming Conferences Block

A very important feature for a site like the one we're building is to have the ability to show users a list of upcoming conferences. But it isn't enough to just show the conferences; we also want to link back to the conference pages, where users can get more information, see when it is, and view the speakers. Let's build an upcoming conferences list as a block in the sidebar.

5.11 Creating the Upcoming Conferences Block

Now that have a lot of data within our site. I feel like when we kind of create a site like this where we're talking about events or conferences. Or anything that has some sort of date sensitive information. One of the best things for us to do from a customer perspective is to give them a list of all of the upcoming events or upcoming conferences. So that whenever the user logs into our site, and they start to navigate around. Immediately, they are shown. Hey, there are some upcoming conferences that you might be interested in, but here's the list. And you can take a look at them and see if any of these pique your interest. So that's one of the first things I want to do. I want to create like an upcoming conferences block in my sidebar, so that the user can quickly and easily see them. So, one way that I can do that is, I can come into a number of these conferences. And I can play with the conference date and make them go a little bit into the future. And I've actually done that. And all you really have to do is go in and edit these. And then go into the conference date and maybe bump up the year to be in 2017 or something like that. Because a lot of the content that Devel creates for you has a lot of dates in the past. Some may be in the future. But just something to keep in mind. You might have to go in here and play with the data a little bit. So what I want to do is create a view that I can also ultimately place as a block within my layout. So, once again, we're going to structure. And I want to create a view just like we've done before. Let's add a new view. And I want to call this, upcoming conferences. And I think, sufficiently for this, we can create a list of maybe the five that are coming up. I think that should be a good list. So let's go ahead and say we want to show content of type. In this case, we want conferences. And let's go ahead and sort the newest first. And that way, we can come down here and select, create a block. And our block title is going to be, upcoming conferences. This can be an unformatted list of titles linked. Because, ultimately, we want to show the user which ones are coming up. And then they can link to it to get more information. And Items per block, five should be fine. But if, for some reason, there's less than that. It will show less than that or something. That should be fine. So let's go ahead and hit save and edit. So now we're into this display block view that we've seen in the past. But I want to tweak this a little bit. Because I really only want to show upcoming conferences that are maybe at least a day out. Or maybe more than that or something like that. So the way that I can do that is by modifying the filter criteria. So, I can come into filter criteria, and I want to add a new filter. So, this is going to take me to the add a new filter dialog. And what I want to do is I want to search on conference. And that's going to show me all these fields here that have to do with conference. And I can start to play around with them a little bit. So what I want to do is I want to find the conference date. As you can see right here, field, underscore, conference date. So I'm going to put a little check mark in this box. And I'm going to click, add and configure filter criteria. So now, what I can do is I can change the operator. And I can create a new filter. I can say, is less than, is greater than, is equal to. Is between, or whatever you want. So in this case, I want to say, is greater than. So that the particular date when this conference is happening is greater than today. Or maybe greater than some offset into the future. So I'm going to say an offset. And I'm going to say an offset from the current time, such as plus one day. So if we're showing them upcoming things that are going on today. That might be kind of difficult for them to maybe make time in their schedule for. So I'm going to say maybe that are at least plus one day. Or maybe plus five days or something like that. So we can just start with maybe plus one day. And make it go out that far from the current time. So then let's go ahead and click, Apply. So now we have our new filter criteria. And we can see the preview. This isn't really going to help us all that much. But this is going to show us some of the sample data. These are the three that I modified to be able to show up with future dates. So we can at least see that part is working. So let's hit, save. And then once this is saved, we can come back to structure. Because remember, when we create that block, it doesn't actually place anything for us yet. So we have to go into block layout. And then we'll come down here. And maybe we'll use that sidebar first again. And we still have that newest articles here. I didn't get rid of that. We can delete that now. Since we don't really need that. It's not relevant to this particular site. So let's go into sidebar first. We'll place our block. And we'll come down into your two upcoming conferences. We'll place that block in there. I think all the defaults should be fine. We want to display the title. Five is the default. Content types, pages, roles. I think everything there looks good. And we want this to be in sidebar first, so let's click, save block. And then we can go back to our site. And now here, we see, here are upcoming conferences. So now we can show each one of these that are in the future, that are at least a day out. Then we can click on them individually, and will take us to each of these particular conferences. So that we can learn more about them and decide if we really would like to go.

Back to the top