Skip to content

Commit

Permalink
[DependencyInjection] Correcting the namespace and adding an xsd file…
Browse files Browse the repository at this point in the history
…. This allows the bundle to be used with xml configuration.
  • Loading branch information
weaverryan authored and ornicar committed Oct 24, 2010
1 parent bb4f166 commit d9cbfe0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
29 changes: 25 additions & 4 deletions DependencyInjection/MenuExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,49 @@

class MenuExtension extends Extension
{
public function templatingLoad($config, ContainerBuilder $container)
/**
* Handles the menu.templating configuration.
*
* @param array $config The configuration being loaded
* @param ContainerBuilder $container
*/
public function templatingLoad(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
$loader->load('templating.xml');
}

public function twigLoad($config, ContainerBuilder $container)
/**
* Handles the menu.templating configuration.
*
* @param array $config The configuration being loaded
* @param ContainerBuilder $container
*/
public function twigLoad(array $config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
$loader->load('twig.xml');
}

/**
* @see Symfony\Component\DependencyInjection\Extension\ExtensionInterface
*/
public function getXsdValidationBasePath()
{
return null;
return __DIR__.'/../Resources/config/schema';
}

/**
* @see Symfony\Component\DependencyInjection\Extension\ExtensionInterface
*/
public function getNamespace()
{
return 'http://www.symfony-project.org/schema/dic/symfony';
return 'http://www.symfony-project.org/schema/dic/menu';
}

/**
* @see Symfony\Component\DependencyInjection\Extension\ExtensionInterface
*/
public function getAlias()
{
return 'menu';
Expand Down
16 changes: 16 additions & 0 deletions Resources/config/schema/menu-1.0.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>

<xsd:schema xmlns="http://www.symfony-project.org/schema/dic/menu"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.symfony-project.org/schema/dic/menu"
elementFormDefault="qualified">


<!-- Define the templating option, with no options or arguments -->
<xsd:element name="templating" type="templating" />
<xsd:complexType name="templating" />

<!-- Define the templating option, with no options or arguments -->
<xsd:element name="twig" type="twig" />
<xsd:complexType name="twig" />
</xsd:schema>

0 comments on commit d9cbfe0

Please sign in to comment.