Permalink
Browse files

Honour assets_base_url if used

  • Loading branch information...
Bendihossan committed Apr 3, 2013
1 parent 343fef4 commit ee7e2f4a47d88c0bd91ebdafb8001a2eeb82f733
Showing with 11 additions and 4 deletions.
  1. +11 −4 Configuration/ConfigurationBuilder.php
@@ -108,18 +108,25 @@ public function setOption($option, $value)
*/
public function getConfiguration()
{
- $rootUrl = '';
if ($this->useControllerForAssets && $this->container->isScopeActive('request')) {
- $rootUrl = $this->container->get('request')->getBaseUrl();
+ $baseUrl = $this->container->get('request')->getBaseUrl();
+ $baseUrl = $baseUrl . '/' . \ltrim($this->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' => $rootUrl . '/' . \ltrim($this->baseUrl, '/'),
+ 'baseUrl' => $baseUrl,
'locale' => $this->translator->getLocale(),
);
if ($this->paths !== null) {
$config['paths'] = $this->paths;
}
return array_merge($config, $this->additionalConfig);
- }
+ }
}

0 comments on commit ee7e2f4

Please sign in to comment.