|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Azine\SocialBarBundle\DependencyInjection; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
6
|
|
|
use Symfony\Component\Config\FileLocator; |
|
7
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
8
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* This is the class that loads and manages your bundle configuration |
|
12
|
|
|
* |
|
13
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
14
|
|
|
*/ |
|
15
|
|
|
class AzineSocialBarExtension extends Extension |
|
16
|
|
|
{ |
|
17
|
|
|
const PREFIX = "azine_social_bar_"; |
|
18
|
|
|
const FB_PROFILE = "fb_profile_url"; |
|
19
|
|
|
const XING_PROFILE = "xing_profile_url"; |
|
20
|
|
|
const LINKED_IN_PROFILE ="linked_in_company_id"; |
|
21
|
|
|
const GOOGLE_PLUS_PROFILE = "google_plus_profile_url"; |
|
22
|
|
|
const TWITTER_PROFILE ="twitter_username"; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritDoc} |
|
26
|
|
|
*/ |
|
27
|
3 |
|
public function load(array $configs, ContainerBuilder $container) |
|
28
|
|
|
{ |
|
29
|
3 |
|
$configuration = new Configuration(); |
|
30
|
3 |
|
$config = $this->processConfiguration($configuration, $configs); |
|
31
|
|
|
|
|
32
|
3 |
View Code Duplication |
if(array_key_exists(self::FB_PROFILE, $config)) |
|
33
|
3 |
|
$container->setParameter(self::PREFIX.self::FB_PROFILE, $config[self::FB_PROFILE]); |
|
34
|
|
|
|
|
35
|
3 |
View Code Duplication |
if(array_key_exists(self::XING_PROFILE, $config)) |
|
36
|
3 |
|
$container->setParameter(self::PREFIX.self::XING_PROFILE, $config[self::XING_PROFILE]); |
|
37
|
|
|
|
|
38
|
3 |
View Code Duplication |
if(array_key_exists(self::LINKED_IN_PROFILE, $config)) |
|
39
|
3 |
|
$container->setParameter(self::PREFIX.self::LINKED_IN_PROFILE, $config[self::LINKED_IN_PROFILE]); |
|
40
|
|
|
|
|
41
|
3 |
View Code Duplication |
if(array_key_exists(self::GOOGLE_PLUS_PROFILE, $config)) |
|
42
|
3 |
|
$container->setParameter(self::PREFIX.self::GOOGLE_PLUS_PROFILE, $config[self::GOOGLE_PLUS_PROFILE]); |
|
43
|
|
|
|
|
44
|
3 |
View Code Duplication |
if(array_key_exists(self::TWITTER_PROFILE, $config)) |
|
45
|
3 |
|
$container->setParameter(self::PREFIX.self::TWITTER_PROFILE, $config[self::TWITTER_PROFILE]); |
|
46
|
|
|
|
|
47
|
3 |
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
48
|
3 |
|
$loader->load('services.yml'); |
|
49
|
|
|
|
|
50
|
3 |
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|