path() public static method

Returns the physical path to an asset in the /webroot directory of an application or plugin.
public static path ( $path, string $type, array $options = [] ) : string
$type string A valid asset type, i.e. `'js'`, `'cs'`, `'image'`, or another type registered with `Media::assets()`, or `'generic'`.
$options array The options used to calculate the path to the file.
return string Returns the physical filesystem path to an asset in the `/webroot` directory.
Beispiel #1
0
 public function testQueryUndefinedAssetTypes()
 {
     $base = Media::path('index.php', 'generic');
     $result = Media::path('index.php', 'foo');
     $this->assertEqual($result, $base);
     $base = Media::asset('/bar', 'generic');
     $result = Media::asset('/bar', 'foo');
     $this->assertEqual($result, $base);
 }