__callStatic()
_init()
add_path()
css()
find_file()
forge()
get_file()
img()
instance()
js()
remove_path()
render()
$_instance
$_instances
$default_config
The Asset class allows you to easily work with your apps assets.
It allows you to specify multiple paths to be searched for the assets.
You can configure the paths by copying the core/config/asset.php config file into your app/config folder and changing the settings.
| package | Fuel |
|---|---|
| subpackage | Core |
__callStatic(string $method, array $args) : mixed
This can be used when new asset types have been dynamically added
stringmethod name
arraypassed arguments
\BadMethodCallException |
|---|
mixed_init() : void
It loads in the config
add_path(string $path, string $type) : void
It adds paths in a way so that asset paths are used First in Last Out.
stringthe path to add
stringoptional path type (js, css or img)
css(mixed $stylesheets, array $attr, string $group, bool $raw) : string
Either adds the stylesheet to the group, or returns the CSS tag.
mixedThe file name, or an array files.
arrayAn array of extra attributes
stringThe asset group name
boolwhether to return the raw file or not when group is not set
stringfind_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths.
| access | public |
|---|
stringThe filename to locate
stringThe type of asset file to search
stringThe sub-folder to look in (optional)
mixedEither the path to the file or false if not foundforge(string $name, array $config) : \Fuel\Core\Asset_Instance
stringinstance name
arraydefault config overrides
get_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths, and return it relative to the docroot
| access | public |
|---|
stringThe filename to locate
stringThe type of asset file
stringThe sub-folder to look in (optional)
mixedEither the path to the file or false if not foundimg(mixed $images, array $attr, string $group) : string
Either adds the image to the group, or returns the image tag.
| access | public |
|---|
mixedThe file name, or an array files.
arrayAn array of extra attributes
stringThe asset group name
stringinstance(string $instance) : \Fuel\Core\Asset_Instance
js(mixed $scripts, array $attr, string $group, bool $raw) : string
Either adds the javascript to the group, or returns the script tag.
mixedThe file name, or an array files.
arrayAn array of extra attributes
stringThe asset group name
boolwhether to return the raw file or not when group is not set
stringremove_path(string $path, $type) : void
stringthe path to remove
render(mixed $group, bool $raw) : string
Each tag will be separated by a line break. You can optionally tell it to render the files raw. This means that all CSS and JS files in the group will be read and the contents included in the returning value.
mixedthe group to render
boolwhether to return the raw file or not
stringthe group's output$_instance : array
$_instances : array
$default_config : array