|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Component\Templating\Helper; |
|
13 |
|
14 use Symfony\Component\Templating\Asset\Package; |
|
15 use Symfony\Component\Templating\Asset\PathPackage; |
|
16 use Symfony\Component\Templating\Asset\UrlPackage; |
|
17 |
|
18 /** |
|
19 * AssetsHelper helps manage asset URLs. |
|
20 * |
|
21 * Usage: |
|
22 * |
|
23 * <code> |
|
24 * <img src="<?php echo $view['assets']->getUrl('foo.png') ?>" /> |
|
25 * </code> |
|
26 * |
|
27 * @author Fabien Potencier <fabien@symfony.com> |
|
28 * @author Kris Wallsmith <kris@symfony.com> |
|
29 */ |
|
30 class AssetsHelper extends CoreAssetsHelper |
|
31 { |
|
32 /** |
|
33 * Constructor. |
|
34 * |
|
35 * @param string $basePath The base path |
|
36 * @param string|array $baseUrls Base asset URLs |
|
37 * @param string $version The asset version |
|
38 * @param string $format The version format |
|
39 * @param array $namedPackages Additional packages |
|
40 */ |
|
41 public function __construct($basePath = null, $baseUrls = array(), $version = null, $format = null, $namedPackages = array()) |
|
42 { |
|
43 if ($baseUrls) { |
|
44 $defaultPackage = new UrlPackage($baseUrls, $version, $format); |
|
45 } else { |
|
46 $defaultPackage = new PathPackage($basePath, $version, $format); |
|
47 } |
|
48 |
|
49 parent::__construct($defaultPackage, $namedPackages); |
|
50 } |
|
51 } |