Overrriding a controller from an existing default Nextcloud app

Hello everyone,

Coming from an e-commerce perspective (Magento), I’m starting to learn Nextcloud related development.

While your documentation is quite exhaustive and simple to apprehend wrt. the creation of theme, I’m a little struggling here to redefine a Controller of an existing app.

While overriding the view (as in MVC) is done easily with the aforementioned documentation, I cannot find a way to redefine the controller of an existing app.

Here, I’m trying to get rid of a slider panel from the first run wizard. Typically, this is what I want:

--- WizardController.php	2020-06-03 11:43:42.865371916 +0200
+++ WizardController.php.new	2020-06-23 15:26:31.247276573 +0200
@@ -91,7 +91,6 @@
 		if ($appStore && $this->groupManager->isAdmin($this->userId)) {
 			$slides[] = $this->staticSlide('page.apps', $data);
 		}
-		$slides[] = $this->staticSlide('page.final', $data);
 
 		return new JSONResponse($slides);
 	}

Here is the file structure I have now:

(master)[wget@hermes nextcloud]$ find themes/wget-test/
themes/wget-test/
themes/wget-test/apps
themes/wget-test/apps/firstrunwizard
themes/wget-test/apps/firstrunwizard/templates
themes/wget-test/apps/firstrunwizard/templates/wizard.php
themes/wget-test/apps/firstrunwizard/templates/personal-settings.php
themes/wget-test/apps/firstrunwizard/templates/page.clients.php
themes/wget-test/apps/firstrunwizard/lib
themes/wget-test/apps/firstrunwizard/lib/Controller
themes/wget-test/apps/firstrunwizard/lib/Controller/WizardController.php
themes/wget-test/apps/spreed
themes/wget-test/apps/spreed/templates
themes/wget-test/apps/spreed/templates/settings
themes/wget-test/apps/spreed/templates/settings/personal
themes/wget-test/apps/settings
themes/wget-test/apps/settings/templates
themes/wget-test/apps/settings/templates/settings
themes/wget-test/apps/settings/templates/settings/personal
themes/wget-test/apps/settings/templates/settings/personal/development.notice.php
themes/wget-test/apps/federatedfilesharing
themes/wget-test/apps/federatedfilesharing/templates
themes/wget-test/apps/federatedfilesharing/templates/settings-personal.php

Some guidance would be nice to have here :slight_smile: Overrriding the Controler is simply not working. What does Nextcloud expect here? Am I expected to create a new app to override Controllers of default Nextcloud apps?

Hello :wave:

This is not documented because, well, you’re not really supposed to do that. There is no such thing as overriding existing controllers in Nextcloud.

Then, what would you recommend to remove the latest slider of the firstrunwizard then (for instance)? :).

Fork the firstrunwizard app, find a way to disable the default one and implement our changes to our fork?

Or just collaborate on the existing app and propose the change to the maintainers?