Skip to content

Commit

Permalink
Merge pull request #11515 from nextcloud/dev/dashboard-event
Browse files Browse the repository at this point in the history
fix(developer): Remove docs for deprecated and removed event
  • Loading branch information
susnux authored Feb 9, 2024
2 parents a69abbd + bc1e509 commit 38a22b3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^^^^^
Expand Down
26 changes: 0 additions & 26 deletions developer_manual/digging_deeper/dashboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down

0 comments on commit 38a22b3

Please sign in to comment.