Pārlūkot izejas kodu

Fix menu builder listener code sample (#4293)

The icon is now defined onto the extras options
and the label can be set directly from child creation options.
Sullivan SENECHAL 8 gadi atpakaļ
vecāks
revīzija
4c060971c1
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 5 5
      Resources/doc/cookbook/recipe_knp_menu.rst

+ 5 - 5
Resources/doc/cookbook/recipe_knp_menu.rst

@@ -151,12 +151,12 @@ You can modify the menu via events easily. You can register as many listeners as
         {
         {
             $menu = $event->getMenu();
             $menu = $event->getMenu();
 
 
-            $child = $menu->addChild('reports', array(
+            $child = $menu->addChild('reports', [
+                'label' => 'Daily and monthly reports',
                 'route' => 'app_reports_index',
                 'route' => 'app_reports_index',
-                'labelAttributes' => array('icon' => 'fa fa-bar-chart'),
-            ));
-
-            $child->setLabel('Daily and monthly reports');
+            ])->setExtras([
+                'icon' => '<i class="fa fa-bar-chart"></i>',
+            ]);
         }
         }
     }
     }