equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony framework. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * This source file is subject to the MIT license that is bundled |
|
9 * with this source code in the file LICENSE. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Bundle\AsseticBundle\Templating; |
|
13 |
|
14 use Assetic\Asset\AssetInterface; |
|
15 use Assetic\Factory\AssetFactory; |
|
16 use Symfony\Component\Templating\Helper\CoreAssetsHelper; |
|
17 |
|
18 /** |
|
19 * The static "assetic" templating helper. |
|
20 * |
|
21 * @author Kris Wallsmith <kris@symfony.com> |
|
22 */ |
|
23 class StaticAsseticHelper extends AsseticHelper |
|
24 { |
|
25 private $assetsHelper; |
|
26 |
|
27 /** |
|
28 * Constructor. |
|
29 * |
|
30 * @param CoreAssetsHelper $assetsHelper The assets helper |
|
31 * @param AssetFactory $factory The asset factory |
|
32 */ |
|
33 public function __construct(CoreAssetsHelper $assetsHelper, AssetFactory $factory) |
|
34 { |
|
35 $this->assetsHelper = $assetsHelper; |
|
36 |
|
37 parent::__construct($factory); |
|
38 } |
|
39 |
|
40 protected function getAssetUrl(AssetInterface $asset, $options = array()) |
|
41 { |
|
42 return $this->assetsHelper->getUrl($asset->getTargetPath(), isset($options['package']) ? $options['package'] : null); |
|
43 } |
|
44 } |