From f1c07490b8b4d0d6128dcfcb103f0d8ea6fc6103 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 24 Nov 2020 10:51:33 +0100 Subject: [PATCH] Drop misleading traces of app.php recommendations The app init docs still recommended using app.php. Signed-off-by: Christoph Wurst --- developer_manual/app_development/init.rst | 40 ++++------------------- developer_manual/basics/events.rst | 2 ++ 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/developer_manual/app_development/init.rst b/developer_manual/app_development/init.rst index f360e369b..183538f8a 100644 --- a/developer_manual/app_development/init.rst +++ b/developer_manual/app_development/init.rst @@ -19,44 +19,16 @@ Navigation entries for apps can be created by adding a navigation section to the -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 - - getJobList()->add('OCA\MyApp\BackgroundJob\Task'); - - // execute OCA\MyApp\Hooks\User::deleteUser before a user is being deleted - \OCP\Util::connectHook('OC_User', 'pre_deleteUser', 'OCA\MyApp\Hooks\User', 'deleteUser'); - - Initialization events --------------------- Often apps do not need to load their JavaScript and CSS on every page. For this purpose there are several events emitted that an app can act upon. -* `OCA\Files::loadAdditionalScripts` (string): loaded on the files list page -* `OCA\Files_Sharing::loadAdditionalScripts` (string): loaded on the public sharing page -* `OCA\Files_Sharing::loadAdditionalScripts::publicShareAuth` (string): loaded on the public share authentication page -* `OCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS` (constant): loaded when a template response is finished -* `OCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN` (constant): loaded when a template response is finished for a logged in user +* ``OCA\Files::loadAdditionalScripts`` (string): loaded on the files list page +* ``OCA\Files_Sharing::loadAdditionalScripts`` (string): loaded on the public sharing page +* ``OCA\Files_Sharing::loadAdditionalScripts::publicShareAuth`` (string): loaded on the public share authentication page +* ``OCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS`` (constant): loaded when a template response is finished +* ``OCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN`` (constant): loaded when a template response is finished for a logged in user -.. 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'); - } - ); +You can subscribe listeners to these events in the :ref:`bootstrapping code` of the app. See the :ref:`events documentation` for more details on the event dispatcher and available events. diff --git a/developer_manual/basics/events.rst b/developer_manual/basics/events.rst index 7a9c4abe7..147d57732 100644 --- a/developer_manual/basics/events.rst +++ b/developer_manual/basics/events.rst @@ -1,3 +1,5 @@ +.. _Events: + ====== Events ======