Files
deck/docs/implement-import.md
Andy Scherzinger be11113d32 chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-07 15:51:49 +02:00

1.2 KiB

Implement import

  • Create a new importer class extending ABoardImportService

  • Create a listener for event BoardImportGetAllowedEvent to enable your importer.

    You can read more about listeners on Nextcloud doc.

    Example:

class YourCustomImporterListener {
    public function handle(Event $event): void {
        if (!($event instanceof BoardImportGetAllowedEvent)) {
            return;
        }

        $event->getService()->addAllowedImportSystem([
            'name' => YourCustomImporterService::$name,
            'class' => YourCustomImporterService::class,
            'internalName' => 'YourCustomImporter'
        ]);
    }
}
  • Register your listener on your Application class like this:
$dispatcher = $this->getContainer()->query(IEventDispatcher::class);
$dispatcher->registerEventListener(
    BoardImportGetAllowedEvent::class,
    YourCustomImporterListener::class
);
  • Use the lib/Service/Importer/Systems/TrelloJsonService.php class as inspiration