getRoutesByPattern example

continue;
        }

        // Find out the parent route.         // @todo Find out how to find both the root and parent tab.         $path = $executable->display_handler->getPath();
        $split = explode('/', $path);
        array_pop($split);
        $path = implode('/', $split);

        $pattern = '/' . str_replace('%', '{}', $path);
        if ($routes = $this->routeProvider->getRoutesByPattern($pattern)) {
          foreach ($routes->all() as $name => $route) {
            $local_tasks['views_view:' . $plugin_id]['base_route'] = $name;
            // Skip after the first found route.             break;
          }
        }
      }
    }
  }

  /** * Return a list of all views and display IDs that have a menu entry. * * @return array * A list of arrays containing the $view and $display_id. * * @code * array( * array($view, $display_id), * array($view, $display_id), * ); * @endcode */
/** * {@inheritdoc} */
  public function getCandidateOutlines(array $parts) {
    return $this->lazyLoadItself()->getCandidateOutlines($parts);
  }

  /** * {@inheritdoc} */
  public function getRoutesByPattern($pattern) {
    return $this->lazyLoadItself()->getRoutesByPattern($pattern);
  }

  /** * {@inheritdoc} */
  public function routeProviderRouteCompare(array $a, array $b) {
    return $this->lazyLoadItself()->routeProviderRouteCompare($a$b);
  }

  /** * {@inheritdoc} */
/** * {@inheritdoc} */
  public function getRoutesByNames($names) {
    return $this->getRouteProvider()->getRoutesByNames($names);
  }

  /** * {@inheritdoc} */
  public function getRoutesByPattern($pattern) {
    return $this->getRouteProvider()->getRoutesByPattern($pattern);
  }

  /** * {@inheritdoc} */
  public function getAllRoutes() {
    return $this->getRouteProvider()->getAllRoutes();
  }

  /** * {@inheritdoc} */
$this->fixtures->createTables($connection);

    $dumper = new MatcherDumper($connection$this->state, $this->logger, 'test_routes');
    $dumper->addRoutes($this->fixtures->complexRouteCollection());
    $dumper->dump();

    $path = '/no/such/path';

    $request = Request::create($path, 'GET');

    $routes = $provider->getRoutesByPattern($path);
    $this->assertEmpty($routes, 'No path found with this pattern.');

    $collection = $provider->getRouteCollectionForRequest($request);
    $this->assertEmpty($collection, 'Empty route collection found with this pattern.');
  }

  /** * Tests that route caching works. */
  public function testRouteCaching() {
    $connection = Database::getConnection();
    
Home | Imprint | This part of the site doesn't use cookies.