1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerShop\Yves\ShopUi; |
9
|
|
|
|
10
|
|
|
use Spryker\Shared\Kernel\Store; |
11
|
|
|
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider; |
12
|
|
|
use Spryker\Yves\Kernel\Container; |
13
|
|
|
use SprykerShop\Yves\ShopUi\Dependency\Client\ShopUiToTwigClientBridge; |
14
|
|
|
|
15
|
|
|
class ShopUiDependencyProvider extends AbstractBundleDependencyProvider |
16
|
|
|
{ |
17
|
|
|
public const CLIENT_TWIG = 'CLIENT_TWIG'; |
18
|
|
|
|
19
|
|
|
public const STORE = 'STORE'; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param \Spryker\Yves\Kernel\Container $container |
23
|
|
|
* |
24
|
|
|
* @return \Spryker\Yves\Kernel\Container |
25
|
|
|
*/ |
26
|
|
|
public function provideDependencies(Container $container): Container |
27
|
|
|
{ |
28
|
|
|
$container = parent::provideDependencies($container); |
29
|
|
|
$container = $this->addTwigClient($container); |
30
|
|
|
$container = $this->addStore($container); |
31
|
|
|
|
32
|
|
|
return $container; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param \Spryker\Yves\Kernel\Container $container |
37
|
|
|
* |
38
|
|
|
* @return \Spryker\Yves\Kernel\Container |
39
|
|
|
*/ |
40
|
|
|
protected function addTwigClient(Container $container): Container |
41
|
|
|
{ |
42
|
|
|
$container->set(static::CLIENT_TWIG, function (Container $container) { |
43
|
|
|
return new ShopUiToTwigClientBridge( |
44
|
|
|
$container->getLocator()->twig()->client() |
45
|
|
|
); |
46
|
|
|
}); |
47
|
|
|
|
48
|
|
|
return $container; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param \Spryker\Yves\Kernel\Container $container |
53
|
|
|
* |
54
|
|
|
* @return \Spryker\Yves\Kernel\Container |
55
|
|
|
*/ |
56
|
|
|
protected function addStore(Container $container): Container |
57
|
|
|
{ |
58
|
|
|
$container->set(static::STORE, function () { |
59
|
|
|
return Store::getInstance(); |
60
|
|
|
}); |
61
|
|
|
|
62
|
|
|
return $container; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|