Skip to content

Commit

Permalink
Merge pull request #2266 from BenoitDuffez/BenoitDuffez-support-canon…
Browse files Browse the repository at this point in the history
…ical-routes

add canonical routes to index
  • Loading branch information
Haehnchen authored Dec 14, 2023
2 parents 53e2345 + 25410e6 commit b2f824d
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,24 @@ public static Map<String, Route> getRoutesInsideUrlGeneratorFile(@NotNull PsiFil
routeArrayOptions.add(PsiTreeUtil.getChildOfType(routeOption, ArrayCreationExpression.class));
}

routes.put(routeArray.getKey(), convertRouteConfigForReturnArray(routeArray.getKey(), routeArrayOptions));
Route route = convertRouteConfigForReturnArray(routeArray.getKey(), routeArrayOptions);
routes.put(routeArray.getKey(), route);

for (ArrayCreationExpression expression : routeArrayOptions) {
for (ArrayHashElement e : expression.getHashElements()) {
PhpPsiElement key = e.getKey();
if (key != null && "'_canonical_route'".equals(key.getText())) {
PhpPsiElement value = e.getValue();
if (value != null) {
String canonical = value.getText().replace("'", "");
if (!routes.containsKey(canonical)) {
routes.put(canonical, route);
}
}
break;
}
}
}
}
}

Expand Down

0 comments on commit b2f824d

Please sign in to comment.