title: Moodle site administration custom links
body: <p>I want to add custom links to an site administration folder, top level, to be something like this:</p>
  
  <p>Site Administration<br>
  - My custom link 1<br>
  - My custom link 2<br>
  .. and then goes standard moodle<br>
  - Notification<br>
  - and so on... </p>
  
  <p>So far, I was able to add custom link to a Main Navigation block, and inside of Administration block, but in Site Administration folder no way.Right now I am getting menu items from settings with $settings = get_config('local_custom_links');<br><br>And it works perfectly if you want to add links in Block Administration.., however if there is anyone who had success with adding links to an Site Administration folder, please help.<br>
  Here is my code:</p>
  
  <pre><code>function local_custom_links_extend_settings_navigation(settings_navigation $nav, context $context) {
  
      $settings = get_config('local_custom_links');
      if (!empty($settings-&gt;menuitems_site_administration) &amp;&amp; $settings-&gt;enable_site_administration) {
          $menu = new custom_menu($settings-&gt;menuitems_site_administration, current_language());
          if ($menu-&gt;has_children()) {
              foreach ($menu-&gt;get_children() as $item) {
                  custom_links_settings_item($item, 0, null, $nav);
              }
          }
      }
  
  }
  
  function custom_links_settings_item(custom_menu_item $menunode, $parent, $pmasternode, settings_navigation $nav) {
  
      global $PAGE, $CFG;
  
      static $submenucount = 0;
  
      if ($menunode-&gt;has_children()) {
          $submenucount++;
          $url = $CFG-&gt;wwwroot;
          if ($menunode-&gt;get_url() !== null) {
              $url = new moodle_url($menunode-&gt;get_url());
          } else {
              $url = null;
          }
          if ($parent &gt; 0) {
              $masternode = $pmasternode-&gt;add($menunode-&gt;get_text(), $url, navigation_node::TYPE_CONTAINER);
          } else {
              $masternode = $nav-&gt;add($menunode-&gt;get_text(), $url, navigation_node::TYPE_CONTAINER);
          }
          foreach ($menunode-&gt;get_children() as $menunode) {
              lambda_custom_links_custom_menu_item($menunode, $submenucount, $masternode, $nav);
          }
      }
  }
  </code></pre>