You are here

public function Router::ofType in Drupal 7 to 8/9 Module Upgrader 8

Gets all items of a specific type.

Parameters

string $link_types: The link type(s), separated by commas (e.g., 'MENU_NORMAL_ITEM, MENU_LOCAL_TASK').

Return value

static

File

src/Routing/Drupal7/Router.php, line 20

Class

Router
Represents a collection of Drupal 7 routes, i.e., the result of hook_menu().

Namespace

Drupal\drupalmoduleupgrader\Routing\Drupal7

Code

public function ofType($link_types) {
  $link_types = array_map('trim', explode(', ', $link_types));
  return $this
    ->filter(function (RouteWrapper $route) use ($link_types) {
    return in_array($route['type'], $link_types);
  });
}