浏览代码

Minimized BC Breaks

Hugo Briand 11 年之前
父节点
当前提交
fb0bd9c9dd

+ 5 - 0
Admin/Admin.php

@@ -1431,6 +1431,11 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
         $menu = $this->menuFactory->createItem('root');
         $menu = $this->menuFactory->createItem('root');
         $menu->setChildrenAttribute('class', 'nav nav-list');
         $menu->setChildrenAttribute('class', 'nav nav-list');
 
 
+        // Prevents BC break with KnpMenuBundle v1.x
+        if (method_exists($menu, "setCurrentUri")) {
+            $menu->setCurrentUri($this->getRequest()->getBaseUrl().$this->getRequest()->getPathInfo());
+        }
+
         $this->configureSideMenu($menu, $action, $childAdmin);
         $this->configureSideMenu($menu, $action, $childAdmin);
 
 
         foreach ($this->getExtensions() as $extension) {
         foreach ($this->getExtensions() as $extension) {

+ 8 - 0
DependencyInjection/SonataAdminExtension.php

@@ -44,6 +44,14 @@ BOOM
             );
             );
         }
         }
 
 
+        if (!isset($bundles['KnpMenuBundle'])) {
+            throw new \RuntimeException(<<<BOOM
+Boom! you are living on the edge ;) The AdminBundle requires the KnpMenuBundle!
+Please add either ``"knplabs/knp-menu-bundle": "~1.1",`` if you want the stable version or ``"knplabs/knp-menu-bundle": "~2.0@dev"`` and ``"knplabs/knp-menu": "~2.0@dev",`` into your composer.json file if you want the MopaBootstrapBundle-compatible version and add the KnpMenuBundle into the AppKernel');
+BOOM
+            );
+        }
+
         if (isset($bundles['SonataUserBundle'])) {
         if (isset($bundles['SonataUserBundle'])) {
             // integrate the SonataUserBundle / FOSUserBundle if the bundle exists
             // integrate the SonataUserBundle / FOSUserBundle if the bundle exists
             array_unshift($configs, array(
             array_unshift($configs, array(

+ 10 - 3
Resources/views/Form/silex_form_div_layout.html.twig

@@ -1,5 +1,11 @@
 {# Widgets #}
 {# Widgets #}
 
 
+{#
+    This file doesn't seem to be used anymore ; commenting it for now in order not to mess with user's configurations.
+    TODO: Remove it and all of its references
+#}
+
+{#
 {% block choice_widget %}
 {% block choice_widget %}
 {% spaceless %}
 {% spaceless %}
     {% if expanded %}
     {% if expanded %}
@@ -39,7 +45,7 @@
 {% endspaceless %}
 {% endspaceless %}
 {% endblock form_widget_simple %}
 {% endblock form_widget_simple %}
 
 
-{# Labels #}
+&#123;&#35; Labels &#35;&#125;
 
 
 {% block form_label %}
 {% block form_label %}
 {% spaceless %}
 {% spaceless %}
@@ -62,7 +68,7 @@
 {% endspaceless %}
 {% endspaceless %}
 {% endblock %}
 {% endblock %}
 
 
-{# Rows #}
+&#123;&#35; Rows &#35;&#125;
 
 
 {% block form_row %}
 {% block form_row %}
 {% spaceless %}
 {% spaceless %}
@@ -76,7 +82,7 @@
 {% endspaceless %}
 {% endspaceless %}
 {% endblock form_row %}
 {% endblock form_row %}
 
 
-{# Misc #}
+&#123;&#35; Misc &#35;&#125;
 
 
 {% block form_errors %}
 {% block form_errors %}
 {% spaceless %}
 {% spaceless %}
@@ -97,3 +103,4 @@
     {% endif %}
     {% endif %}
 {% endspaceless %}
 {% endspaceless %}
 {% endblock form_errors %}
 {% endblock form_errors %}
+#}

+ 0 - 2
composer.json

@@ -29,8 +29,6 @@
         "sensio/generator-bundle": "~2.2",
         "sensio/generator-bundle": "~2.2",
         "twig/twig": "~1.12",
         "twig/twig": "~1.12",
         "twig/extensions": "~1.0",
         "twig/extensions": "~1.0",
-        "knplabs/knp-menu-bundle": "~2.0@dev",
-        "knplabs/knp-menu": "~2.0@dev",
         "sonata-project/jquery-bundle": "1.8.*",
         "sonata-project/jquery-bundle": "1.8.*",
         "sonata-project/exporter": "1.*",
         "sonata-project/exporter": "1.*",
         "sonata-project/block-bundle": "~2.2,>=2.2.7",
         "sonata-project/block-bundle": "~2.2,>=2.2.7",