Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert the check of the route name #5868

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/Factory/AdminContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ private function getDashboardDto(Request $request, DashboardControllerInterface
$dashboardControllerRoutes = !file_exists($dashboardRoutesCachePath) ? [] : require $dashboardRoutesCachePath;
$dashboardController = $dashboardControllerInstance::class.'::index';
$dashboardRouteName = null;
$currentRouteName = $request->attributes->get('_route');

foreach ($dashboardControllerRoutes as $routeName => $controller) {
// checking if the route name matches is needed because the same
// dashboard controller can be associated to more than one route
// (see https://github.com/EasyCorp/EasyAdminBundle/pull/5853)
if ($controller === $dashboardController && $currentRouteName === $routeName) {
if ($controller === $dashboardController) {
// if present, remove the suffix of i18n route names (it's a two-letter locale at the end
// of the route name; e.g. 'dashboard.en' -> remove '.en', 'admin.index.es' -> remove '.es')
$dashboardRouteName = preg_replace('~\.\w{2}$~', '', $routeName);
Expand Down
Loading