1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is a part of Sculpin. |
5
|
|
|
* |
6
|
|
|
* (c) Dragonfly Development Inc. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Symplify\PHP7_Sculpin\PostsBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\FileLocator; |
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
16
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
17
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Sculpin Posts Extension. |
21
|
|
|
* |
22
|
|
|
* @author Beau Simensen <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class SculpinPostsExtension extends Extension |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* {@inheritdoc} |
28
|
|
|
*/ |
29
|
|
|
public function load(array $configs, ContainerBuilder $container) |
30
|
|
|
{ |
31
|
|
|
$configuration = new Configuration(); |
32
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
33
|
|
|
|
34
|
|
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
35
|
|
|
$loader->load('services.yml'); |
36
|
|
|
|
37
|
|
|
$container->setParameter('sculpin_posts.paths', $config['paths']); |
38
|
|
|
if (isset($config['permalink'])) { |
39
|
|
|
$container->setParameter('sculpin_posts.permalink', $config['permalink']); |
40
|
|
|
} |
41
|
|
|
if (isset($config['layout'])) { |
42
|
|
|
$container->setParameter('sculpin_posts.layout', $config['layout']); |
43
|
|
|
} else { |
44
|
|
|
$container->setParameter('sculpin_posts.layout', null); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|