瀏覽代碼

added documentation

Toni Rudolf 11 年之前
父節點
當前提交
bdbac2046e
共有 1 個文件被更改,包括 32 次插入0 次删除
  1. 32 0
      Resources/doc/reference/advanced.rst

+ 32 - 0
Resources/doc/reference/advanced.rst

@@ -229,3 +229,35 @@ You will just need to change the way forms are configured in order to take into
             $form->add('year', 'integer');
         }
     }
+
+
+Dropdowns in Tab Menu
+---------------------
+
+You can use dropdowns inside the Tab Menu by default. This can be achieved by using
+the `"dropdown" => true` attribute:
+
+.. code-block:: php
+
+    <?php
+    // YourNS\AdminBundle\Admin\PersonAdmin.php
+
+    protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
+    {
+        // ...other tab menu stuff
+
+        $menu->addChild('comments', array('attributes' => array('dropdown' => true)));
+        $menu['comments']->addChild('list', array('uri' => $admin->generateUrl('listComment', array('id' => $id))));
+        $menu['comments']->addChild('create', array('uri' => $admin->generateUrl('addComment', array('id' => $id))));
+    }
+
+
+If you want to use the Tab Menu in a different way, you can replace the Menu Template:
+
+.. configuration-block::
+
+    .. code-block:: yaml
+
+        sonata_admin:
+            templates:
+                tab_menu_template:  YourNSAdminBundle:Admin:own_tab_menu_template.html.twig