You are here

function fz152_menu_links_discovered_alter in FZ152 8

Implements hook_menu_links_discovered_alter().

File

./fz152.module, line 103
Main file for hooks and custom functions.

Code

function fz152_menu_links_discovered_alter(&$links) {
  $plugin_service = \Drupal::service('plugin.manager.fz152');
  foreach ($plugin_service
    ->getDefinitions() as $plugin_id => $plugin) {
    $instance = $plugin_service
      ->createInstance($plugin_id);
    $route_info = $instance
      ->getSettingsPage();
    $links['fz152.admin.' . $plugin_id] = [
      'title' => $route_info['title'],
      'route_name' => 'fz152.settings.' . $plugin_id,
      'parent' => 'fz152.admin',
    ];
  }
}