Problem / Motivation
If you are rendering entities in a search index, you may see this error on index:
InvalidArgumentException while trying to render item (entityidhere) with view mode full for search index Acquia Search Solr Index: Route required in Drupal\Core\Url::fromRouteMatch()
The error is happening because src/EasyBreadcrumbBuilder.php calls Url::fromRouteMatch($route_match) but $route_match does not have a route object.
Proposed Resolution
Add a condition to check for the route object. If the route object does not exist, do not render a link.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | easy_breadcrumb-InvalidArgumentException-fromRouteMatch-3158327-2.patch | 688 bytes | josephdpurcell |
Comments
Comment #2
josephdpurcell commentedComment #3
josephdpurcell commentedI've applied the patch and it resolves the error on index. It needs reviewed to ensure there is not adverse behavior.
Comment #4
josephdpurcell commentedAdding issues in other modules and code that cause issues due to fromRouteMatch() throwing an exception.
Comment #5
greg boggsComment #7
greg boggs