forked from KnpLabs/KnpMarkdownBundle
/
MarkdownExtension.php
55 lines (44 loc) · 1.46 KB
/
MarkdownExtension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace Knplabs\MarkdownBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class MarkdownExtension extends Extension
{
public function parserLoad($config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('parser.xml');
if(isset($config['class'])) {
$container->setParameter('markdown.parser.class', $config['class']);
}
}
public function helperLoad($config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('helper.xml');
}
public function twigLoad($config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('twig.xml');
}
/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
*/
public function getXsdValidationBasePath()
{
return null;
}
public function getNamespace()
{
return 'http://www.symfony-project.org/schema/dic/symfony';
}
public function getAlias()
{
return 'markdown';
}
}