コード例 #1
0
 /**
  * Returns the collection of routes in the source.
  *
  * @return RouterInterface
  *   The requested link collection.
  */
 public function getSourceRoutes()
 {
     if (empty($this->sourceRoutes)) {
         $this->sourceRoutes = new Drupal7Router();
         $items = call_user_func($this->target->id() . '_menu');
         foreach ($items as $path => $item) {
             $this->sourceRoutes->addRoute(new Drupal7Route($path, $item));
         }
         // Now that all routes have been loaded, tell them to resolve their
         // hierarchical relationships.
         $this->sourceRoutes->finalize();
     }
     return $this->sourceRoutes;
 }