Open
Description
The RouteEntity
producer currently only works with entities with route name of format anything.TYPE_NAME.anything
.
Code which shows that (RouteEntity.php):
[, $type] = explode('.', $url->getRouteName());
$parameters = $url->getRouteParameters();
$id = $parameters[$type];
$resolver = $this->entityBuffer->add($type, $id);
This does not work with views which have a path assigned, because views have the following routename format: view.VIEW_ID.PAGE_ID
.
When you use the RouteEntity producer on a path which translates to a view, it will throw an error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "__SOME_VIEW_ID__" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (Line 143 in /docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php).
There should be a check implemented for entity / view
. Something like this:
[$baseType, $type] = explode('.', $url->getRouteName());
if ($baseType === 'entity') {
$parameters = $url->getRouteParameters();
$id = $parameters[$type];
} else if ($baseType === 'view') {
// View routeNames have format 'view.VIEW_ID.PAGE_ID'
$id = $type;
$type = 'view';
} else {
return NULL;
}
$resolver = $this->entityBuffer->add($type, $id);