|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the eZ Publish Kernel package. |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
|
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace eZ\Bundle\EzPublishCoreBundle\Imagine; |
|
10
|
|
|
|
|
11
|
|
|
use eZ\Publish\Core\MVC\ConfigResolverInterface; |
|
12
|
|
|
|
|
13
|
|
|
class PlaceholderAliasGeneratorConfigurator |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var \eZ\Publish\Core\MVC\ConfigResolverInterface |
|
17
|
|
|
*/ |
|
18
|
|
|
private $configResolver; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var \eZ\Bundle\EzPublishCoreBundle\Imagine\PlaceholderProviderRegistry |
|
22
|
|
|
*/ |
|
23
|
|
|
private $providerRegistry; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
private $providersConfig; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* PlaceholderAliasGeneratorConfigurator constructor. |
|
32
|
|
|
* |
|
33
|
|
|
* @param \eZ\Publish\Core\MVC\ConfigResolverInterface $configResolver |
|
34
|
|
|
* @param \eZ\Bundle\EzPublishCoreBundle\Imagine\PlaceholderProviderRegistry $providerRegistry |
|
35
|
|
|
* @param array $providersConfig |
|
36
|
|
|
*/ |
|
37
|
|
|
public function __construct(ConfigResolverInterface $configResolver, PlaceholderProviderRegistry $providerRegistry, array $providersConfig) |
|
38
|
|
|
{ |
|
39
|
|
|
$this->configResolver = $configResolver; |
|
40
|
|
|
$this->providerRegistry = $providerRegistry; |
|
41
|
|
|
$this->providersConfig = $providersConfig; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function configure(PlaceholderAliasGenerator $generator) |
|
45
|
|
|
{ |
|
46
|
|
|
$binaryHandlerName = $this->configResolver->getParameter('io.binarydata_handler'); |
|
47
|
|
|
|
|
48
|
|
|
if (isset($this->providersConfig[$binaryHandlerName])) { |
|
49
|
|
|
$providersConfig = $this->providersConfig[$binaryHandlerName]; |
|
50
|
|
|
|
|
51
|
|
|
$provider = $this->providerRegistry->getProvider($providersConfig['provider']); |
|
52
|
|
|
$generator->setPlaceholderProvider($provider, $providersConfig['options']); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|