public static attach ( string $name, array $config = null ) : void | ||
$name | string | The name of the media you wish to attach. |
$config | array | Asset configuration options for the given scope. - `'path'` _string_: Path of the media. - `'prefix'` _string_: Contains the uri prefix. Such as `css`. - `'absolute'` _boolean_: Defaults to `false`. If you want to generate absolute URL's. - `'host'` _mixed_: String host, or array of hosts, of the media, if absolute is `true`. - `'scheme'` _mixed_: String scheme, or array of sc, of the media, if absolute is `true`. |
리턴 | void |
public static function attach($name, $config = null)
{
if (!isset(static::$_scopes)) {
static::_initScopes();
}
if ($name === false) {
$name = '__defaultScope__';
}
if (is_array($config) || $config === false) {
static::$_scopes->set($name, $config);
}
}
public function testScopeBase() { $result = Media::asset('style.css', 'css'); $this->assertEqual('/css/style.css', $result); Media::attach(false, array('base' => 'lithium/app/webroot')); $result = Media::asset('style.css', 'css'); $this->assertEqual('/lithium/app/webroot/css/style.css', $result); }