__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
string
method name
array
passed 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.
string
the path to add
string
optional 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.
mixed
The file name, or an array files.
array
An array of extra attributes
string
The asset group name
bool
whether to return the raw file or not when group is not set
string
find_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths.
access | public |
---|
string
The filename to locate
string
The type of asset file to search
string
The sub-folder to look in (optional)
mixed
Either the path to the file or false if not foundforge(string $name, array $config) : \Fuel\Core\Asset_Instance
string
instance name
array
default 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 |
---|
string
The filename to locate
string
The type of asset file
string
The sub-folder to look in (optional)
mixed
Either 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 |
---|
mixed
The file name, or an array files.
array
An array of extra attributes
string
The asset group name
string
instance(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.
mixed
The file name, or an array files.
array
An array of extra attributes
string
The asset group name
bool
whether to return the raw file or not when group is not set
string
remove_path(string $path, $type) : void
string
the 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.
mixed
the group to render
bool
whether to return the raw file or not
string
the group's output$_instance : array
$_instances : array
$default_config : array