In this chapter we will walk through using dates as contextual filters, also known as arguments in Drupal-speak. We will create a block which shows us content per month, based on pur date field, and allow users to page through the months.
In this chapter we continue working with Date filters in Views and look at using the created and updated core date fields.
Dates with Drupal 7
CourseIn this chapter Michelle will walk us through using our new date field with Views to create a listing of our content showing the dates associated with them. We'll be listing our date content, with an exposed filter for selecting the date range, and we look at how to set relative dates to fill in the form's default values.
You'll need to the Views and Chaos Tools modules for this chapter. If you would like a refresher on using Views, you can watch our Intro to Views for Drupal 7 series.
Note: With an update in Date module (7.x-2.x), you can now change the format of the date in the exposed filter. It's not a completely smooth process, but here are some instructions for how to get this working.
1. Ensure that the following modules and their dependencies are enabled: Date, Date Views, Date Popup, Views UI.
2. Add a date field to a content type. Collect only the date (not the time -- uncheck hours, minutes, seconds). Create some content with a date.
3. Create a new view of fields filtered by the content type in which you added a date field.
4. Update the format as described in the video to table and add a label to the Title field.
5. Add the date field to fields. Choose the "short" format to display.
6. Add the date field to filters. Select "day" as granularity.
7. Expose the date filter. Configure it as described in the video.
8. The exposed date filter should show a long format in the text field, which is not what we want.
9. In a new tab, go to Configuration > Regional and Language > Date and time > Types
10. For the Date Type of "Short", select the 2nd option (10/21/2014 - 12:29). Save configuration.
11. Go back to your view and refresh the page. The date popup format should now be in the short format. It should now respect whatever format you choose for "Short" in the Date and Type settings.
In this chapter we dive deeper into the Date field and look at all the configuration options that come with the Date field out of the box. We'll also enable the Date All Day and Date Popup modules to see some nice additions to our main Date field.
In this chapter, Karen turns on the Date, Date API, and Date tools modules, and walks us through some initial configuration of core date settings, so that we can use Date module properly. We look at the site timezone settings, as well as talk about the core date formats. Then we go ahead and create some new custom date formats and date types.
When you learn how Drupal handles dates, you can create event functionality, listing pages with a unique result set, and calendars. The Dates Series begins with basic configurations and the contributed modules required to integrate with other functionality. In addition to creating a new content type for our Date field via the wizard, we also explore all possible configuration choices by diving deeper into the Date field. Once we have content on our site, we move into displaying the content in unique ways in Views by using basic filters, exposed filters and contextual filters. Other demonstrations in this series include working with multiple date fields, repeating dates and integrating with the Context module.
If you would like to work along with the video, the entire demo site can be downloaded and set up (it is found on the introduction video's Downloads tab). The zip file includes the Drupal files, the database, and a README.txt file to explain setting it up. The site was created using the Demonstration module so that you can switch back and forth among the finished states of the various chapters.
Once you have your site up and running it is very important to keep your site up to date and secure. Both Drupal core and contributed projects continue to improve the software with bug fixes and security updates. In this chapter we look at using the core Update Manager, and explain how to read the various reports about our site's status. Before we walk through the process up updating a contributed module, as well as our version of Drupal core, we also make sure we do a backup.
In this chapter we're going to go through a launch checklist to make sure we have a few things all set up before we actually put our site out there. We discuss:
- error reporting settings
- 403 and 404 pages
- performance optimization and caching
- reviewing the status reports
- disabling unnecessary modules
In this chapter Joe covers two really important tools for most sites: cron and search. We start by explaining what cron is, and how core provides us with a basic cron tool. We also walk through how to set up your own custom cron if the core settings don't suit you. Next we look at Drupal's core search and the various ways you can configure that.
In this chapter, we look at the Drupal file system configuration, and we set up our site to give us private file storage. We'll talk about what that means, and the benefits and drawbacks to Drupal's private files.
In this chapter we talk about the powerful and flexible user system in Drupal. We'll create new users and roles, and walk through how the permissions work with them.
In this chapter, we talk all about changing the look and feel of your site with themes. We start by reviewing the settings that come with our default core theme, Bartik. Then we go to Drupal.org to look at available contributed themes, how to look for themes, and discuss what a base theme is. We'll finish up by actually installing a new contributed theme, Zero Point, and making some configuration changes.
In this chapter Michelle will explain what blocks are and how we can use them on our site. We'll look at the demo regions where we can place our blocks, and move some things around. We'll also look at creating our own simple custom block, along with covering the ways that we can change the visibility settings.
In this video we take a tour of Drupal menus, and show you how you can modify existing menu items and create your own.
In this chapter we'll quickly cover how to create lists of our Press Releases to display on the site. We'll be using the Views module to create a block that can sit in the sidebar, as well as a full listing page with its own menu item. You will need to already have the Views module downloaded and enabled on your site. If you need help installing a contributed module, watch the Installing and Enabling Modules in Drupal 7 video from this series.
To get a complete tutorial on using Views, you can watch our Intro to Views for Drupal 7 series.
In this chapter we talk about Drupal's taxonomy system, which is a way to organize our content. We'll walk through the steps to create a new vocabulary, add some terms, and then use it with our Press Release content type.
In this video we'll start talking about the structure of content on the site by explaining what a content type is and how to create our own custom content types. First we review the two content types that are provided by Drupal core, Article and Basic Page, and then we dive into creating our own new content type, a Press Release. We also add a few fields and review configuring the field display.
For more instruction on using Fields and Image styles, check out these other series:
Intro to Fields for Site Builders
Image Styles