This JS app is a proof of concept for an events manager using Drupal 8 as a backend.
This app requires uses an "Events" content type. Here's the setup:
Field label | Machine name | Field type |
---|---|---|
Attendee Limit | field_attendee_limit | Number (integer) |
End Date | field_end_date | Date |
Event Details | body | Text (formatted, long, with summary) |
Hosted by | field_organizations | Entity reference |
Location | field_location | Entity reference |
Public Event | field_public_event | Boolean |
RSVP Required | field_rsvp_required | Boolean |
Start Date | field_date | Date |
There are two "Entity reference" fields in the Events content type. This is because the "Hosted by" and "Location" fields are populated by taxonomy terms.
The "Hosted by" field uses the Organizations taxonomy, which is a list of schools, departments, and other organizations. It includes one custom field:
Field label | Machine name | Field type |
---|---|---|
Organization type | field_organization_type | List (text) |
The current values for the Organization type field are:
- School
- Unit
- Organization
- Campus
The "Location" field uses the Locations taxonomy, which is is a list of locations where events can be held. It includes one custom field:
Field label | Machine name | Field type |
---|---|---|
Address | field_address | Text (plain) |
This app also requires a custom view, which allows Drupal to return the data from the Events content type as a JSON object. A few customizations of note:
- The Show Format has been set to "Fields".
- The Path has been set to
"/events/"
. - The Sort Criteria has been set to "Content: Start Date (asc)".
- The Filter Criteria has been set to:
- "Content: Publishing status (= Yes)"
- "Content: Content type (= Event)"
- "Content: Start Date (>= +0 minutes)"
- The Pager has been set to "Display all items". (I may come to regret this later.)
The fields being exposed in this view are:
| Field | Formatter | Alias | ------- | ------- | Content: Title | Plain text | Content: Attendee Limit | Default | Content: Body | value | Content: Hosted by | Label | field_host | Content: Hosted by (id) | Entity ID | field_host_id | Content: Location | Label | Content: Path | | Content: Public Event | Boolean (yes/no) | Content: Publishing status | Boolean (true/false) | Content: RSVP Required | Boolean (yes/no) | Content: End Date | Plain | Content: Start Date | Plain | Content: ID |