You are here

public function MenuBadgesManager::getLocalBadgesForRoutes in Menu Badges 8

File

src/MenuBadgesManager.php, line 74

Class

MenuBadgesManager

Namespace

Drupal\menu_badges

Code

public function getLocalBadgesForRoutes($routes = array()) {
  $local_badges = $this->config
    ->get('local_badges');
  $badges = array(
    MenuBadgesManager::LOCAL_TASK => array(),
    MenuBadgesManager::LOCAL_ACTION => array(),
  );
  if (!empty($local_badges)) {
    foreach ($local_badges as $key_type => $key_badges) {
      foreach ($key_badges as $route_id => $info) {
        if (empty($routes) || in_array(str_replace('|', '.', $route_id), $routes)) {
          $badges[$key_type][$route_id] = $info;
        }
      }
    }
  }
  return $badges;
}