function RouteSubscriber::setUpBaseRoute

Same name in other branches
  1. 11.x core/modules/block_content/src/Routing/RouteSubscriber.php \Drupal\block_content\Routing\RouteSubscriber::setUpBaseRoute()

Gets parameters from a base route and saves them in class variables.

Parameters

string $base_route_name: The name of a base route that already has a BC variant.

Return value

bool TRUE if all parameters are set, FALSE if not.

1 call to RouteSubscriber::setUpBaseRoute()
RouteSubscriber::alterRoutes in core/modules/block_content/src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

core/modules/block_content/src/Routing/RouteSubscriber.php, line 101

Class

RouteSubscriber
Subscriber for Block content BC routes.

Namespace

Drupal\block_content\Routing

Code

protected function setUpBaseRoute(string $base_route_name) : bool {
    $base_route = $this->collection
        ->get($base_route_name);
    $base_route_bc = $this->collection
        ->get("{$base_route_name}.bc");
    if (empty($base_route) || empty($base_route_bc)) {
        return FALSE;
    }
    $this->basePath = $base_route->getPath();
    $this->basePathBc = $base_route_bc->getPath();
    $this->controller = $base_route_bc->getDefault('_controller');
    if (empty($this->basePath) || empty($this->basePathBc) || empty($this->controller) || $this->basePathBc === $this->basePath) {
        return FALSE;
    }
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.