File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 14
14
use Knp \Menu \ItemInterface as MenuItemInterface ;
15
15
use Sonata \AdminBundle \Admin \AdminExtension ;
16
16
use Sonata \AdminBundle \Admin \AdminInterface ;
17
+ use Symfony \Cmf \Bundle \CoreBundle \Translatable \TranslatableInterface ;
17
18
use Symfony \Cmf \Bundle \RoutingBundle \Doctrine \Phpcr \PrefixInterface ;
18
19
use Symfony \Cmf \Component \Routing \RouteReferrersReadInterface ;
19
20
use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
@@ -75,7 +76,7 @@ public function configureTabMenu(
75
76
if (!$ subject instanceof RouteReferrersReadInterface && !$ subject instanceof Route) {
76
77
throw new InvalidConfigurationException (
77
78
sprintf (
78
- '%s can only be used on subjects which implement Symfony\Cmf\Component\Routing\RouteReferrersReadInterface or Symfony\Component\Routing\Route! ' ,
79
+ '%s can only be used on subjects which implement Symfony\Cmf\Component\Routing\RouteReferrersReadInterface or Symfony\Component\Routing\Route. ' ,
79
80
__CLASS__
80
81
)
81
82
);
@@ -86,8 +87,15 @@ public function configureTabMenu(
86
87
return ;
87
88
}
88
89
90
+ $ defaults = array ();
91
+ if ($ subject instanceof TranslatableInterface) {
92
+ if ($ locale = $ subject ->getLocale ()) {
93
+ $ defaults ['_locale ' ] = $ locale ;
94
+ }
95
+ }
96
+
89
97
try {
90
- $ uri = $ this ->router ->generate ($ subject );
98
+ $ uri = $ this ->router ->generate ($ subject, $ defaults );
91
99
} catch (RoutingExceptionInterface $ e ) {
92
100
// we have no valid route
93
101
return ;
You can’t perform that action at this time.
0 commit comments