11. Configuring bundles in the user interface
11.1. Enable Field UI for events
Section titled “11.1. Enable Field UI for events”-
Add the following to the attributes in
src/Entity/Event.php: -
Rebuild caches
Run
drush cache:rebuild -
Visit
/admin/structure/event-typesand edit an event type.Note that there is a Manage fields, Manage form display and Manage display operation for each event type.
11.2. Add dynamic fields to events
Section titled “11.2. Add dynamic fields to events”The ability to have comments is managed as a field in Drupal, so we can use Field UI to add a Comments field to an event type.
-
Add a comment type on
/admin/structure/comment/types/addSelect Event as the target entity type
-
Add a Comments field to an event type
11.3. Configure view modes
Section titled “11.3. Configure view modes”-
Visit the Manage display page
Note that only the Comments field appears
-
Add the following to all field definitions in the
baseFieldDefinitions()method of theEventclass before the semicolon: -
Rebuild caches
Run
drush cache:rebuild -
Verify that all fields now appear
-
Upload user pictures for the existing users
-
Use Rendered entity for the Attendees field on the Manage display page
-
Add a Teaser view mode on
/admin/structure/display-modes/view/add/event -
Make the Teaser view mode configurable on the event type’s Manage display page
-
Rebuild caches
Run
drush cache:rebuild -
Configure the Teaser view mode
-
Add an Event teasers view
-
Add a Page views display with the path
eventsNote that the path is entered without a leading slash in Views.
-
Use the Unformatted list style for the display
Display Events in the Teaser view mode
-
Verify that the event teasers are displayed correctly
11.4. Configure the form
Section titled “11.4. Configure the form”-
Visit the Manage form display page
Note that only the Comments field appears
-
Add the following to all field definitions in the
baseFieldDefinitions()method of theEventclass before the semicolon: -
Rebuild caches
Run
drush cache:rebuild -
Note that all fields now appear
-
Configure the form display
-
Use the Select list widget for the Date field
-
Use the Check boxes/radio buttons widget for the Attendees field