From b284838446c70f7e1cbbab31b76641b6fc3cbe92 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Thu, 15 Jan 2015 16:53:14 +0100 Subject: [PATCH] Converts all fixed event field names to snake case. Fixes #18. --- README.md | 28 ++++++++++++++-------------- blueprints/calendar.php | 12 ++++++------ calendar/lib/Event.php | 10 +++++----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 6169512..29e8e63 100644 --- a/README.md +++ b/README.md @@ -44,17 +44,17 @@ Title: Calendar Calendar: - summary: My Event - _beginDate: 12/14/2014 - _beginTime: 10:00 - _endDate: 12/14/2014 - _endTime: 15:00 + _begin_date: 12/14/2014 + _begin_time: 10:00 + _end_date: 12/14/2014 + _end_time: 15:00 - summary: My supercool event for the whole day description: This wil be a nice event! - _beginDate: 10/01/2014 + _begin_date: 10/01/2014 ``` -The `Calendar` field contains all events in a [YAML](http://getkirby.com/blog/structured-field-content) list. Each event has several own fields, too, but of them only `_beginDate` is mandatory (see [event-fields](#event-fields)). You can define as many other fields as you like. +The `Calendar` field contains all events in a [YAML](http://getkirby.com/blog/structured-field-content) list. Each event has several own fields, too, but of them only `_begin_date` is mandatory (see [event-fields](#event-fields)). You can define as many other fields as you like. ### Calendar object @@ -120,20 +120,20 @@ The locale is set by Kirby's language configuration. So if you've set up everyth Events can have arbitrary fields. However there are the special fields for this plugin marked by a `_`-prefix: -- `_beginDate`: The only **mandatory** field specifying the date, the event begins. -- `_beginTime`: The time of the day the event begins. -- `_endDate`: The date the event ends. -- `_endTime`: The time of the day the event ends. +- `_begin_date`: The only **mandatory** field specifying the date, the event begins. +- `_begin_time`: The time of the day the event begins. +- `_end_date`: The date the event ends. +- `_end_time`: The time of the day the event ends. The behavior with different combinations of these fields is the following: -- only `_beginDate` given: The event lasts the whole day. +- only `_begin_date` given: The event lasts the whole day. -- `_beginDate` and `_beginTime` given: The event lasts from the given time until midnight (12 am) of the following day. +- `_begin_date` and `_begin_time` given: The event lasts from the given time until midnight (12 am) of the following day. -- `_beginDate` and `_endTime` given: The event lasts from midnight until the given time of the day. +- `_begin_date` and `_end_time` given: The event lasts from midnight until the given time of the day. -- `_beginDate` and `_endDate` given: The event lasts from mindnight of the beginning day until midnight of the day after the ending day. +- `_begin_date` and `_end_date` given: The event lasts from mindnight of the beginning day until midnight of the day after the ending day. ## Functions diff --git a/blueprints/calendar.php b/blueprints/calendar.php index ad8bfda..a42c5bf 100644 --- a/blueprints/calendar.php +++ b/blueprints/calendar.php @@ -12,8 +12,8 @@ entry: > {{summary}}
{{description}}
- Beginning: {{_beginDate}} {{_beginTime}}
- End: {{_endDate}} {{_endTime}} + Beginning: {{_begin_date}} {{_begin_time}}
+ End: {{_end_date}} {{_end_time}} fields: summary: label: Summary @@ -22,19 +22,19 @@ label: Description type: textarea size: small - _beginDate: + _begin_date: label: Beginning date type: date format: MM/DD/YYYY - _beginTime: + _begin_time: label: Beginning time type: time interval: 15 - _endDate: + _end_date: label: Ending date type: date format: MM/DD/YYYY - _endTime: + _end_time: label: Ending time type: time interval: 15 \ No newline at end of file diff --git a/calendar/lib/Event.php b/calendar/lib/Event.php index 7675a93..cd2956b 100644 --- a/calendar/lib/Event.php +++ b/calendar/lib/Event.php @@ -5,22 +5,22 @@ class Event { /** * The string for the beginning date field key of an event. */ - const beginDateKey = '_beginDate'; + const beginDateKey = '_begin_date'; /** * The string for the beginning time field key of an event. */ - const beginTimeKey = '_beginTime'; + const beginTimeKey = '_begin_time'; /** * The string for the end date field key of an event. */ - const endDateKey = '_endDate'; + const endDateKey = '_end_date'; /** * The string for the end time field key of an event. */ - const endTimeKey = '_endTime'; + const endTimeKey = '_end_time'; /** * An array of field keys that are required to create an event. @@ -66,7 +66,7 @@ class Event { /** * @param array $event The fields of this event including the 'private' - * fields which start with a _ (e.g. _beginDate). + * fields which start with a _ (e.g. _begin_date). */ function __construct($event) { self::validate($event);