Merge pull request #11515 from nextcloud/dev/dashboard-event

fix(developer): Remove docs for deprecated and removed event
This commit is contained in:
Ferdinand Thiessen
2024-02-09 10:42:24 +01:00
committed by GitHub
2 changed files with 1 additions and 27 deletions

View File

@@ -80,7 +80,7 @@ Deprecated events
Removed events
^^^^^^^^^^^^^^
* tbd
* ``OCP\Dashboard\RegisterWidgetEvent`` was deprecated in Nextcloud 20 and is now removed. Use ``OCP\AppFramework\Bootstrap\IRegistrationContext::registerDashboardWidget`` from within your app bootstrap.
Changed behavior
^^^^^^^^^^^^^^^^

View File

@@ -121,32 +121,6 @@ The `MyAppWidget` class needs to be registered during the :ref:`app bootstrap<Bo
}
}
For compatibility reasons the widget registration can also be performed by
listening to the `OCP\\Dashboard\\RegisterWidgetEvent` for apps that still
need to support older versions where the new app boostrap flow is not available,
however this method is deprecated and will be removed once Nextcloud 19 is EOL.
.. code-block:: php
<?php
use OCP\Dashboard\RegisterWidgetEvent;
use OCP\EventDispatcher\IEventDispatcher;
class Application extends App {
public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
$container = $this->getContainer();
/** @var IEventDispatcher $dispatcher */
$dispatcher = $container->getServer()->get(IEventDispatcher::class);
$dispatcher->addListener(RegisterWidgetEvent::class, function (RegisterWidgetEvent $event) use ($container): void {
\OCP\Util::addScript('myapp', 'dashboard');
$event->registerWidget(MyAppWidget::class);
});
}
}
The IConditionalWidget interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^