You are here

public static function WeMegaMenuBuilder::routeExists in Drupal Mega Menu 8.x

Same name and namespace in other branches
  1. 8 src/WeMegaMenuBuilder.php \Drupal\we_megamenu\WeMegaMenuBuilder::routeExists()

Check router exists.

Parameters

string $name as router name: Public static function routeExists string name.

Return value

int Public static function routeExists int.

1 call to WeMegaMenuBuilder::routeExists()
template_preprocess_we_megamenu_ul in ./we_megamenu.module
Prepare variables for we_megamenu_ul.

File

src/WeMegaMenuBuilder.php, line 222

Class

WeMegaMenuBuilder

Namespace

Drupal\we_megamenu

Code

public static function routeExists($name) {
  $route_provider = Drupal::service('router.route_provider');
  $route_provider = $route_provider
    ->getRoutesByNames([
    $name,
  ]);
  return count($route_provider);
}