Calendar Fieldtype
Calendar utilizes the power of ExpressionEngine's Channels. Every event is created in an intuitive fieldtype as part of a channel entry. Therefore, you can take advantage of any and as many custom fields and field types, categories, etc to go along with your calendar data. If you can do it to an entry in EE, you can do it to a Calendar event.
Creating a Calendar fieldtype
Creating Calendar field(s) is done just like any other fieldtype. Here's an overview of the process:
- Go to the Channel Manager area in the CP. Click on Field Groups nav item on left, and under the applicable Field Group, select Fields button.
- At top right, click the Create New button.
- For the Type option, select Calendar from the list.
- Name the field as you wish - for example Event Info with short name of event_info.
- Scroll down to Field Options area of the page.
- For Default Calendar field (required), select a calendar to be used as the default calendar for when creating new event entries. Be sure that you have created at least 1 calendar.
- In the ICS Export Description field setting, select the channel field will contain the description when using ICS export. This is an optional setting, and only applies to ICS exporting.
- In the ICS Export Location field setting, select the channel field that will contain the location when using ICS export. This is an optional setting, and only applies to ICS exporting.
- Click Save Field button to save the new custom field.
How the Fieldtype works
Events are any channel entries that contain the Calendar fieldtype. Event data is stored in and handled by the Calendar fieldtype. Only one instance of the Calendar fieldtype per channel (entry) is allowed.
Best practice is to create a new channel called "Events" (or use an existing one, etc) specifically for events, and then a create Calendar field for it. If you want to have more than 1 set of events, you can create more event channels, and a Calendar field for each of them.
The Calendar fieldtype also works with the EE Channel:Form front end template tag. The Calendar add-on template tags know to look for Calendar data by checking to see which channel(s) contain the Calendar fieldtype.
Fieldtype options
You can watch the video to see all of the available Event Fieldtype UI options and interactions. A list of this is available below.
The Solspace Calendar Event Fieldtype UI allows you to create events with the following options:
- Calendar (required) - displays a list of predefined calendars to choose from
- Calendars are filtered by the currently logged in members' member group privileges
- Default calendar is selected as defined in field type preferences
- Start Date & Time (datepicker & timepicker in 30m increments) (required)
- End Date & Time (datepicker & timepicker in 30m increments) (required) - if this is a recurring event, this should be the end of the first occurrence
- All Day event option - if selected, the Start and End Time fields hide
- Repeating option - when selected, recurrence rules (frequency) display
- Daily
- Repeats every _ day(s)
- Weekly
- Repeats every _ week(s) on
- S M T W T F S (multiple select)
- Repeats every _ week(s) on
- Monthly
- Repeats every _ month(s)
- Each:
- 1 through 31 full month calendar picker table view (multiple select)
- On the First/Second/Third/Fourth/Last (4th or 5th)
- S M T W T F S (multiple select)
- Each:
- Repeats every _ month(s)
- Yearly
- Repeats every _ year(s)
- [checkbox] On the First/Second/Third/Fourth/Last (4th or 5th)
- S M T W T F S (multiple select) of
- January through December (multiple select)
- [checkbox] On the First/Second/Third/Fourth/Last (4th or 5th)
- Repeats every _ year(s)
- Select Dates - displays a date picker that allows you to select days to manually include recurrences. Select date inclusions can be applied either by clicking the date in the date picker, or by typing the date in the input field and hitting Enter.
- For each date selected, they are displayed in a list. Each selected date can be removed by clicking the - beside it.
- NOTE: Selected dates cannot be used in conjunction with other rule types. All selected dates cannot have different times, as event times must be uniform.
- Until (datepicker) - when the recurrence rules end (required). Use the date picker or type the date in the input field and hit Enter.
- Exclude - displays a month view date picker that allows you to select days to exclude recurrences from displaying in the front end on. Exclusions can be applied either by clicking the date in the date picker, or by typing the date in the input field and hitting Enter.
- For each date selected, they are displayed in a list. Each selected date can be removed by clicking the X beside it.
- Daily
How to Use
Calendar event data and recurrences are automatically detected by Calendar template tags, and many different variables and conditionals are available for use to display your events. Your best option is to check out the code examples in the documentation, or better year, give the Demo Templates a spin to see it all in full action.
Calendar event data is also available as a regular EE custom field within the EE Channel:Entries template tag. For use in the Channel:Entries tag, refer to the Calendar documentation for this.