Skip to content

Commit

Permalink
Merge pull request #1144 from City-of-Helsinki/UHF-X_url_getroutepara…
Browse files Browse the repository at this point in the history
…ms_exception

catch in case of external route with no route parameters
  • Loading branch information
rpnykanen authored Dec 20, 2024
2 parents e6e0d1c + c61319f commit 2b18785
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,13 @@ function hdbt_preprocess_block(&$variables): void {
$front_page = Url::fromRoute('<front>', [], ['absolute' => TRUE]);
$uri_parts = parse_url($front_page->toString());
$url = Url::fromUri('internal:' . $uri_parts['path']);
$params = $url->getRouteParameters();

try {
$params = $url->getRouteParameters();
}
catch (\Exception $e) {
$params = [];
}

if (!empty($params)) {
$entity_type = key($params);
Expand Down

0 comments on commit 2b18785

Please sign in to comment.