Jelajahi Sumber

Fixed the Configuration class

It now supports XML config files properly and the default value for the
logo works when the site is not at the root of the domain.
Christophe Coevoet 13 tahun lalu
induk
melakukan
61439b1f6a
1 mengubah file dengan 7 tambahan dan 9 penghapusan
  1. 7 9
      DependencyInjection/Configuration.php

+ 7 - 9
DependencyInjection/Configuration.php

@@ -35,23 +35,20 @@ class Configuration implements ConfigurationInterface
         $treeBuilder = new TreeBuilder();
         $treeBuilder = new TreeBuilder();
         $rootNode = $treeBuilder->root('sonata_admin', 'array');
         $rootNode = $treeBuilder->root('sonata_admin', 'array');
 
 
-        $this->addTemplateSection($rootNode);
-
-        return $treeBuilder;
-    }
-
-    private function addTemplateSection(ArrayNodeDefinition $rootNode)
-    {
         $rootNode
         $rootNode
+            ->fixXmlConfig('dashboard_group')
+            ->fixXmlConfig('admin_service')
             ->children()
             ->children()
                 ->scalarNode('security_handler')->defaultValue('sonata.admin.security.handler.noop')->end()
                 ->scalarNode('security_handler')->defaultValue('sonata.admin.security.handler.noop')->end()
 
 
                 ->scalarNode('title')->defaultValue('Sonata Admin')->cannotBeEmpty()->end()
                 ->scalarNode('title')->defaultValue('Sonata Admin')->cannotBeEmpty()->end()
-                ->scalarNode('title_logo')->defaultValue('/bundles/sonataadmin/logo_title.png')->cannotBeEmpty()->end()
+                ->scalarNode('title_logo')->defaultValue('bundles/sonataadmin/logo_title.png')->cannotBeEmpty()->end()
 
 
                 ->arrayNode('dashboard_groups')
                 ->arrayNode('dashboard_groups')
                     ->useAttributeAsKey('id')
                     ->useAttributeAsKey('id')
                     ->prototype('array')
                     ->prototype('array')
+                        ->fixXmlConfig('item')
+                        ->fixXmlConfig('item_add')
                         ->children()
                         ->children()
                             ->scalarNode('label')->end()
                             ->scalarNode('label')->end()
                             ->arrayNode('items')
                             ->arrayNode('items')
@@ -68,7 +65,6 @@ class Configuration implements ConfigurationInterface
                     ->useAttributeAsKey('id')
                     ->useAttributeAsKey('id')
                     ->prototype('array')
                     ->prototype('array')
                         ->children()
                         ->children()
-                            ->scalarNode('id')->end()
                             ->scalarNode('model_manager')->end()
                             ->scalarNode('model_manager')->end()
                             ->scalarNode('form_contractor')->end()
                             ->scalarNode('form_contractor')->end()
                             ->scalarNode('show_builder')->end()
                             ->scalarNode('show_builder')->end()
@@ -97,5 +93,7 @@ class Configuration implements ConfigurationInterface
                 ->end()
                 ->end()
             ->end()
             ->end()
         ->end();
         ->end();
+
+        return $treeBuilder;
     }
     }
 }
 }