Commit e758608a by Alexander Makarov

Added Url::asset

parent 3400eb52
...@@ -57,9 +57,20 @@ class BaseUrl ...@@ -57,9 +57,20 @@ class BaseUrl
if ($url !== '' && ($url[0] === '/' || $url[0] === '#' || strpos($url, '://') || !strncmp($url, './', 2))) { if ($url !== '' && ($url[0] === '/' || $url[0] === '#' || strpos($url, '://') || !strncmp($url, './', 2))) {
return $url; return $url;
} else { } else {
return Yii::$app->getRequest()->getBaseUrl() . '/' . $url; return static::asset($url);
} }
} }
} }
/**
* Prefixes relative URL with base URL
*
* @param string $url relative URL
* @return string absolute URL
*/
public function asset($url)
{
return Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment