You are here

function cacheflush_ui_menu_links_discovered_alter in CacheFlush 8

Implements hook_menu_links_discovered_alter().

File

modules/cacheflush_ui/cacheflush_ui.module, line 98
Cacheflush User Interface.

Code

function cacheflush_ui_menu_links_discovered_alter(&$links) {
  $menus = cacheflush_load_multiple_by_properties([
    'status' => CacheflushUIConstantsInterface::CACHEFLUSH_PUBLISHED,
    'menu' => CacheflushUIConstantsInterface::CACHEFLUSH_MENU,
  ]);
  if ($menus) {
    foreach ($menus as $entity) {
      $links['cacheflush.presets.' . $entity
        ->id()] = [
        'title' => $entity
          ->getTitle(),
        'route_name' => 'cacheflush.presets.clear_id',
        'parent' => 'cacheflush.presets',
        'route_parameters' => [
          'cacheflush' => $entity
            ->id(),
        ],
      ];
    }
  }
}