getRouteDefinitions example

if (!$this->lock->acquire('router_rebuild')) {
      // Wait for another request that is already doing this work.       // We choose to block here since otherwise the routes might not be       // available, resulting in a 404.       $this->lock->wait('router_rebuild');
      return FALSE;
    }

    $this->building = TRUE;

    $collection = new RouteCollection();
    foreach ($this->getRouteDefinitions() as $routes) {
      // The top-level 'routes_callback' is a list of methods in controller       // syntax, see \Drupal\Core\Controller\ControllerResolver. These methods       // should return a set of \Symfony\Component\Routing\Route objects, either       // in an associative array keyed by the route name, which will be iterated       // over and added to the collection for this provider, or as a new       // \Symfony\Component\Routing\RouteCollection object, which will be added       // to the collection.       if (isset($routes['route_callbacks'])) {
        foreach ($routes['route_callbacks'] as $route_callback) {
          $callback = $this->controllerResolver->getControllerFromDefinition($route_callback);
          if ($callback_routes = call_user_func($callback)) {
            
Home | Imprint | This part of the site doesn't use cookies.