How to get a sibling admin_category of 'Site administration' ?

How to get a sibling admin_category of 'Site administration' ?

by Mike Finch -
Number of replies: 1

In my local plugin, in settings.php, I add a admin_category to the administration block.

$cat = new admin_category( 'local_foo', 'Foo administration' );
$ADMIN->add( 'root', $cat );

In Moodle 3.0 (and also in Moodle 3.3 as I recall), the result is that my category appears in the Administration block as a sibling of the 'Site administration' category.  For example:

+-------------------------+
| ADMINISTRATION          |
|                         |
| > Site administration   |
|   * Notifications       |
|   * Advanced features   |
|     ...                 |
| > Foo administration    |
+-------------------------+

However, in Moodle 3.5, using that same code, the result is that my category appears as a child of the 'Site administration' category.  For example:

+-------------------------+
| ADMINISTRATION          |
|                         |
| > Site administration   |
|   * Notifications       |
|   * Advanced features   |
|     ...                 |
|   > Foo administration  |
+-------------------------+

What has changed in Moodle 3.5?   Is the name of the topmost navigation node of the Administration block now something else other than 'root' ?

Average of ratings: -
In reply to Mike Finch

Re: How to get a sibling admin_category of 'Site administration' ?

by Mike Finch -

Please disregard this post and my foolish question.  That is what I get for not sleeping.  smile

I remember now that to get a category to appear as a sibling of the 'Site administration' category, I must define it in the plugin's local_foo_extend_settings_navigation() function in lib.php. For example:

function local_foo_extend_settings_navigation( settings_navigation $nav, context $context )
{
  $cat = navigation_node::create( 'Foo administration' );
  $nav->add_node( $cat );
}