Create a List Tab For Drupal Calendar

Posted on April 27, 2016 - 4 Minute Read

Resources:


Introduction and Requirements

Drupal's Calendar module allows an easy way for site builders to display events in a month, week day and year format right out of the box. However, I recently needed to add an additional tab to the view display to list all upcoming events. The requirements were that this would become the default display for the view, meaning that the list would display be default if user didn't supply any arguments to the URL. For example, if the user navigated to example.com/events they would see the list of all upcoming events instead of the month view. In order to follow along in this tutorial you will need a content type that is using a Date field with an end date. You will also need the Calendar module installed.

Below is what we will be creating.

Note that the All tab displays first by default, and displays all upcoming events in a list.

Create a Calendar From Template

  1. Navigate to the Views configuration page admin/structure/views and click Add view from template

1 1

  1. Find the Calendar view that utilizes a Date field, and click add. In my case, my date field is called field_date.

1 2

Add a New Tab to the Calendar to List All Events

  1. First, let's update the path for all the displays (Month, Week, Day and Year). By default it's set to use the field name. Let's update it to use events. Below are my final paths.

    1. ​Month: events/month
    2. ​Week: events/week
    3. ​Day: events/day
    4. ​Year: events/year

1 3

  1. Now we need to remove the Month view as the Parent menu item. Go to the Month view and click the Tab: Month link.

  2. Select Menu tab. Configure the tab using the following info.

1 4

Title Description Menu Weight
Month Leave Blank Navigation 0
  1. Add a new page.

1 5

  1. Set the path to events/all

1 6

  1. Under Menu: set the type to Default menu tab and click Apply

1 7

  1. On the next screen, configure the tab using the following info.
Parent menu item Title Description Menu
Normal menu item Events Navigation Leave Blank
  1. Under Format change the format from Calendar to Unformatted list. Make sure to to select This page (override).

1 9

  1. Under Format show fields. Make sure to to select This page (override).

1 10

  1. Under FILTER CRITERIA add Date: Date (node)

1 11

  1. One the next screen, leave all the defaults. Select the start date field of the date field you are displaying in the calendar views.

1 12

  1. One the next screen set the Operator to Is greater than or equal to the Relative date of 12AM today.

1 13

  1. Save the view.
Categorized In:Tagged In: