@@ -30,18 +30,22 @@ git submodule add https://github.com/scottboms/kirby-events-field.git site/plugi
3030
3131In a Page blueprint, add a new field with the type ` event. ` Standard field attributes such as ` label, required, help ` , etc. can also be used to override defaults. Use ` empty ` to change the text displayed when the field is in an empty state.
3232
33- #### Field Properties
34-
35- | Name | Type | Default | Description |
36- | -----------| ---------| ---------| ------------------------------------------------------------------|
37- | empty | string | ` null ` | The placeholder text if no information has been added |
38- | time | boolean | ` true ` | Include time as part of date fields |
39- | eventName | boolean | ` true ` | If ` true ` , the field is available in the form |
40- | endDate | boolean | ` true ` | If ` true ` , the field is available in the form |
41- | venue | boolean | ` true ` | If ` true ` , the field is available in the form |
42- | url | boolean | ` true ` | If ` true ` , the field is available in the form |
43- | details | boolean | ` true ` | If ` true ` , the field is available in the form |
44- | preview | array | ` [ ] ` | Optional array of field names to display in the preview |
33+ ### Field Properties
34+
35+ | Name | Type | Default | Description |
36+ | ------------| ---------| ---------| -----------------------------------------------------------------|
37+ | empty | string | ` null ` | The placeholder text if no information has been added |
38+ | eventName | boolean | ` true ` | If ` true ` , the field is available in the form |
39+ | endDate | boolean | ` true ` | If ` true ` , the field is available in the form |
40+ | hoursStart | boolean | ` true ` | If ` true ` , the field is available in the form |
41+ | hoursEnd | boolean | ` true ` | If ` true ` , the field is available in the form |
42+ | city | boolean | ` true ` | If ` true ` , the field is available in the form |
43+ | state | boolean | ` true ` | If ` true ` , the field is available in the form |
44+ | country | boolean | ` true ` | If ` true ` , the field is available in the form |
45+ | venue | boolean | ` true ` | If ` true ` , the field is available in the form |
46+ | url | boolean | ` true ` | If ` true ` , the field is available in the form |
47+ | details | boolean | ` true ` | If ` true ` , the field is available in the form |
48+ | preview | array | ` [ ] ` | Optional array of field names to display in the preview |
4549
4650
4751``` yml
@@ -55,11 +59,15 @@ In a Page blueprint, add a new field with the type `event.` Standard field attri
5559 type : event
5660 empty : ' Add an event'
5761
58- # field attributes to include
62+ # optional field properties
5963 eventName : true
60- endDate : false
61- time : false
64+ endDate : true
65+ hoursStart : true
66+ hoursEnd : true
6267 venue : true
68+ city : true
69+ state : true
70+ country : true
6371 url : true
6472 details : true
6573
@@ -68,9 +76,14 @@ In a Page blueprint, add a new field with the type `event.` Standard field attri
6876 - eventName
6977 - startDate
7078 - endDate
79+ - hoursStart
80+ - hoursEnd
81+ - eventDates # summary of startDate, endDate
82+ - eventHours # summary of hoursStart, hoursEnd
7183 - city
7284 - state
7385 - country
86+ - location # summary of city, state, country
7487 - venue
7588 - url
7689 - details
@@ -87,7 +100,9 @@ To access an event field in your templates, you can use the toEvent() method.
87100
88101<div class="dates">
89102 <span class="start"><?= $event->startDate()->toDate('M d, Y') ?></span> –
90- <span class="end"><?= $event->endDate()->toDate('M d, Y') ?></span>
103+ <span class="end"><?= $event->endDate()->toDate('M d, Y') ?></span>, daily from
104+ <span class="start"><?= $event->hoursStart()->toDate('g:i a') ?></span> –
105+ <span class="end"><?= $event->hoursEnd()->toDate('g:i a') ?></span>
91106</div>
92107
93108<div class="location">
@@ -101,6 +116,10 @@ To access an event field in your templates, you can use the toEvent() method.
101116<?php endif ?>
102117```
103118
119+ ### Field Methods
120+
121+ Special Field Methods have been included to provide additional utility when utilizing the field. These include a ` toEvent() ` wrapper which behaves similarly to Kirby's native toStructure() method. Additionally, a ` daysUntil() ` method allows you to provide a simple countdown based on the field's ` startDate ` value.
122+
104123
105124## Compatibility
106125
0 commit comments