Last active
December 15, 2015 17:49
-
-
Save Bendihossan/5299619 to your computer and use it in GitHub Desktop.
Honour assets_base_urls if used
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the RequireJS configuration options. | |
* @return array | |
*/ | |
public function getConfiguration() | |
{ | |
if ($this->useControllerForAssets && $this->container->isScopeActive('request')) { | |
$baseUrl = $this->container->get('request')->getBaseUrl(); | |
$baseUrl = \ltrim($baseUrl, '/'); | |
} else { | |
$baseUrl = $this->container->get('templating.helper.assets')->getUrl(\ltrim($this->baseUrl, '/')); | |
// remove ?version from end of URL | |
if (($p = strpos($baseUrl, '?')) !== false) { | |
$baseUrl = substr($baseUrl, 0, $p); | |
} | |
} | |
$config = array( | |
'baseUrl' => $baseUrl, | |
'locale' => $this->translator->getLocale(), | |
); | |
if ($this->paths !== null) { | |
$config['paths'] = $this->paths; | |
} | |
return array_merge($config, $this->additionalConfig); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment