|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Superdesk Web Publisher Core Bundle. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright 2016 Sourcefabric z.ú. and contributors. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please see the |
|
9
|
|
|
* AUTHORS and LICENSE files distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @copyright 2016 Sourcefabric z.ú |
|
12
|
|
|
* @license http://www.superdesk.org/license |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace SWP\Bundle\CoreBundle\DependencyInjection\Compiler; |
|
16
|
|
|
|
|
17
|
|
|
use SWP\Bundle\CoreBundle\Resolver\AssetLocationResolver; |
|
18
|
|
|
use SWP\Bundle\CoreBundle\Resolver\AuthorAssetLocationResolver; |
|
19
|
|
|
use SWP\Bundle\CoreBundle\Resolver\SeoAssetLocationResolver; |
|
20
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
21
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
|
22
|
|
|
|
|
23
|
|
|
final class OverrideAssetLocationResolver extends AbstractOverridePass |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* {@inheritdoc} |
|
27
|
|
|
*/ |
|
28
|
|
|
public function process(ContainerBuilder $container) |
|
29
|
|
|
{ |
|
30
|
|
|
$assetLocationResolverDefinition = $this->getDefinitionIfExists($container, 'swp.resolver.asset_location'); |
|
31
|
|
|
if (null !== $assetLocationResolverDefinition) { |
|
32
|
|
|
$assetLocationResolverDefinition |
|
33
|
|
|
->setClass(AssetLocationResolver::class) |
|
34
|
|
|
->addMethodCall('setTenantContext', [new Reference('swp_multi_tenancy.tenant_context')]); |
|
35
|
|
|
|
|
36
|
|
|
$authorAssetLocationResolverDefinition = $this->getDefinitionIfExists($container, 'swp.resolver.author_asset_location'); |
|
37
|
|
|
$authorAssetLocationResolverDefinition |
|
38
|
|
|
->setClass(AuthorAssetLocationResolver::class) |
|
39
|
|
|
->setArguments($assetLocationResolverDefinition->getArguments()) |
|
40
|
|
|
->addMethodCall('setTenantContext', [new Reference('swp_multi_tenancy.tenant_context')]) |
|
41
|
|
|
->setPublic(true) |
|
42
|
|
|
; |
|
43
|
|
|
|
|
44
|
|
|
$authorAssetLocationResolverDefinition = $this->getDefinitionIfExists($container, 'swp.resolver.seo_asset_location'); |
|
45
|
|
|
$authorAssetLocationResolverDefinition |
|
46
|
|
|
->setClass(SeoAssetLocationResolver::class) |
|
47
|
|
|
->setArguments($assetLocationResolverDefinition->getArguments()) |
|
48
|
|
|
->addMethodCall('setTenantContext', [new Reference('swp_multi_tenancy.tenant_context')]) |
|
49
|
|
|
->setPublic(true) |
|
50
|
|
|
; |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|