How to define a route in appinfo.xml, which routes to users personal settings

Hi! I just got into developing my first nextcloud app :smiley:

Its lookin pretty good so far, but i now have the following problem:

Im trying to set up a custom menu/navigation item which has its route set to:

im trying to set this up in the appinfo.xml:

            <name>Navigation Entry Name</name>
            <route>#ROUTE HERE</route>

but i dont know how to pull it properly, as I dont know what goes into the <route></route>

I hope someone can help


you missed the idea of the route tag. In general, a normal route consists of a triple of strings. The parts are separated by a period (.). The parts are

  1. The name of the app
  2. The name of the controller (e.g. FooBarController is represented as fooBar AFAIK)
  3. The name of the route

The name of the route is typically the name of the method in the controller class. This name can be augmented by a postfix string that can be configured to allow for handling multiple routes with the same method.

You can/must configure the routes in appinfo/routes.php . That is, you create the controller classes and methods. Then, you add a route entry to the routes.php and give it a URL this way. Having done that, you can register this in the appinfo/info.xml to be accessible in the navigation.

The URL index.php/settings/user/sync-clients as requested is not part of your app. In fact, the settings app handles these (you see it in the first part settings, thus the settings app). You can register a setting in the info.xml using <settings>...</settings>. But it is not intended to be accessible in the main navigation.

I am unsure, what your use case is exactly. Normally, you will not want to provide a setting as main navigation entry to all users.

Does this somehow help you?

1 Like