diff --git a/developer_manual/digging_deeper/groupware/calendar_provider.rst b/developer_manual/digging_deeper/groupware/calendar_provider.rst index 723c2b09d..9681e427a 100644 --- a/developer_manual/digging_deeper/groupware/calendar_provider.rst +++ b/developer_manual/digging_deeper/groupware/calendar_provider.rst @@ -7,6 +7,103 @@ Integration of custom calendar providers Nextcloud apps can register calendars in addition to the internal calendars of the Nextcloud CalDAV back end. Calendars are only loaded on demand, therefore a lazy provider mechanism is used. +The access to the calendars is possible in two ways: the legacy way uses the classes of the DAV app directly to interact with Sabre. In order to simplify access, the Nextcloud team has started some effort to include the Sabre interface in an embedded interface in Nextcloud. However, there are a few shortcomings here that are not not yet finished. + +If you work on a new app and want to provide a calendar, check if the embedded code suits your requirements. If it does, it might be simpler to use it than to use the legacy Sabre interface. + +All snippets are prefixed by ``` with ``$context->registerCalendarProvider(CalendarProvider::class);``. + + +Write support +~~~~~~~~~~~~~ + +Calendars that only return `ICalendar` are implicitly read-only. If your app's calendars can be written to, you may implement the ``ICreateFromString`` interface. It will allow other apps to write calendar objects to the calendar by passing the raw iCalendar data as string. + +.. code-block:: php + + `_ + +.. code-block:: php + + OCA\YourAppName\DAV\CalendarPlugin - -Appendix: Registering the calendar with the PHP API interface -------------------------------------------------------------- - -Additionally to the registration in the DAV app, the core provides another way to register a calendar. - -.. note:: Currently, the PHP API is not used by the DAV app. Any registered calendar will not automatically show up in the calendar's view or the CalDAV list. This might change in the future, thus it might be a good idea to provide this interface as well. - -Read-only support -~~~~~~~~~~~~~~~~~ - -To provide calendar(s) you have to write a class that implements the ``OCP\Calendar\ICalendarProvider`` interface. - -.. code-block:: php - - ` with ``$context->registerCalendarProvider(CalendarProvider::class);``. - - -Write support -~~~~~~~~~~~~~ - -Calendars that only return `ICalendar` are implicitly read-only. If your app's calendars can be written to, you may implement the ``ICreateFromString`` interface. It will allow other apps to write calendar objects to the calendar by passing the raw iCalendar data as string. - -.. code-block:: php - - `_ - -.. code-block:: php - -