From 8af5f1f5475eb9d39259570f2d0966a1f83b1d0d Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 31 Jan 2019 12:50:12 +0100 Subject: [PATCH] Add events to listen for Signed-off-by: Roeland Jago Douma --- developer_manual/app/init.rst | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/developer_manual/app/init.rst b/developer_manual/app/init.rst index 6c71ee757..2c8deb1fa 100644 --- a/developer_manual/app/init.rst +++ b/developer_manual/app/init.rst @@ -25,7 +25,7 @@ Further pre-app configuration The :file:`appinfo/app.php` is the first file that is loaded and executed in Nextcloud. Depending on the purpose of the app it is usually used to setup things that need to be available on every request to the server, like :doc:`backgroundjobs` and :doc:`hooks` registrations. This is how an example :file:`appinfo/app.php` could look like: .. code-block:: php - + getEventDispatcher(); + + $dispatcher->addListener( + OCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, + function() { + \OCP\Util::addScript('myapp', 'script'); + \OCP\Util::addStyle('myapp', 'style'); + } + ); Best practice ------------- @@ -68,11 +85,11 @@ lib/AppInfo/Application.php