Router.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Routing/Drupal7/Router.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Routing\Drupal7;
use Drupal\drupalmoduleupgrader\Routing\RouterBase;
class Router extends RouterBase {
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);
});
}
public function getAllLinks() {
return $this
->filter(function (RouteWrapper $route) {
return $route
->hasLink();
});
}
public function getLinks() {
return $this
->filter(function (RouteWrapper $route) {
return $route
->isLink();
});
}
public function getLocalTasks() {
return $this
->filter(function (RouteWrapper $route) {
return $route
->isLocalTask();
});
}
public function getDefaultLocalTasks() {
return $this
->filter(function (RouteWrapper $route) {
return $route
->isDefaultLocalTask();
});
}
public function getLocalActions() {
return $this
->filter(function (RouteWrapper $route) {
return $route
->isLocalAction();
});
}
public function getContextualLinks() {
return $this
->filter(function (RouteWrapper $route) {
return $route
->isContextualLink();
});
}
}
Classes
Name |
Description |
Router |
Represents a collection of Drupal 7 routes, i.e., the result of hook_menu(). |