/** * {@inheritDoc} */ public function getFunctions() { return array_merge(parent::getFunctions(), [new Twig_SimpleFunction('cdn', function ($outputPath) { $basePath = rtrim($this->app['assets.output_path']); $assetPath = $basePath . '/' . $outputPath; $assetModified = file_exists($assetPath) ? filemtime($assetPath) : null; $cacheBuster = substr(sha1($assetModified), 0, 7); return rtrim($this->app['assets.output_uri'], '/') . '/' . $outputPath . '?' . $cacheBuster; })]); }
public function getGlobals() { $globals = parent::getGlobals(); $globals['assetic']['use_controller'] = $this->useController; return $globals; }
public function __construct(AssetFactory $factory, $functions = array(), ValueSupplierInterface $valueSupplier = null, $app = null) { parent::__construct($factory, $functions, $valueSupplier); $this->app = $app; }