Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RouteCollection.php

function RouteCollection::remove

Removes a route or an array of routes by name from the collection.

Parameters

string|string[] $name The route name or an array of route names:

File

vendor/symfony/routing/RouteCollection.php, line 143

Class

RouteCollection
A RouteCollection represents a set of Route instances.

Namespace

Symfony\Component\Routing

Code

public function remove(string|array $name) : void {
    $routes = [];
    foreach ((array) $name as $n) {
        if (isset($this->routes[$n])) {
            $routes[] = $n;
        }
        unset($this->routes[$n], $this->priorities[$n], $this->aliases[$n]);
    }
    if (!$routes) {
        return;
    }
    foreach ($this->aliases as $k => $alias) {
        if (\in_array($alias->getId(), $routes, true)) {
            unset($this->aliases[$k]);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal