NavigationManager: two ways of configuration programmatic via add() and app info XML

The NavigationManager.php has two approaches of configuring navigation elements, via nodes in the app info XML and programmatically via add() calls:

From app info XML:


After introduction of building the navigation from the app info XML, a programmatic approach was implemented on top of it:

  1. Is there a preferred way of configuring the navigation?
  2. When should either way be avoided?

I found and read the docs (App Developer Guide ā€” nextcloudappstore 2.0.0 documentation), yet it does not answer why this dual way of configuring things exists. Configuration via the app info XML seems to be the intuitive way.


  1. First two links swapped

When moving the configuration to app info XML, I can see that the menu entry text is not translated. This could be solved by passing the <name> text content though localization though.

The questions remain.

Could we move all navigation configs to the app info XML (and possibly create missing mechanisms for that)?

Honestly, I do not see what you are seeing. The changes are mainly in the lib/private folder aka the OC namespace. No app should use these classes directly. So, no change so far.

Note I switched the first two links (already corrected).

Scope is not app development.

I want to understand NextCloud internal code better and this is where Iā€™m stuck wondering why there are two ways of configuration.

The first two links show the init() method using two ways of building the navigation.