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 1414use Knp \Menu \ItemInterface as MenuItemInterface ;
1515use Sonata \AdminBundle \Admin \AdminExtension ;
1616use Sonata \AdminBundle \Admin \AdminInterface ;
17+ use Symfony \Cmf \Bundle \CoreBundle \Translatable \TranslatableInterface ;
1718use Symfony \Cmf \Bundle \RoutingBundle \Doctrine \Phpcr \PrefixInterface ;
1819use Symfony \Cmf \Component \Routing \RouteReferrersReadInterface ;
1920use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
@@ -75,7 +76,7 @@ public function configureTabMenu(
7576 if (!$ subject instanceof RouteReferrersReadInterface && !$ subject instanceof Route) {
7677 throw new InvalidConfigurationException (
7778 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. ' ,
7980 __CLASS__
8081 )
8182 );
@@ -86,8 +87,15 @@ public function configureTabMenu(
8687 return ;
8788 }
8889
90+ $ defaults = array ();
91+ if ($ subject instanceof TranslatableInterface) {
92+ if ($ locale = $ subject ->getLocale ()) {
93+ $ defaults ['_locale ' ] = $ locale ;
94+ }
95+ }
96+
8997 try {
90- $ uri = $ this ->router ->generate ($ subject );
98+ $ uri = $ this ->router ->generate ($ subject, $ defaults );
9199 } catch (RoutingExceptionInterface $ e ) {
92100 // we have no valid route
93101 return ;
You can’t perform that action at this time.
0 commit comments