__call()
__construct()
add_path()
add_type()
assettype()
find_file()
get_file()
remove_path()
render()
_parse_assets()
_unify_path()
render_css()
render_img()
render_js()
$_add_mtime
$_always_resolve
$_asset_paths
$_asset_url
$_auto_render
$_fail_silently
$_groups
$_indent
$_path_folders
$_renderers
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 |
__call($method, $args) : mixed
__construct(array $config)
array
add_path(string $path, string $type) : object
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)
object
current instanceadd_type(string $type, string $path, \Fuel\Core\Closure $renderer) : object
string
new path type
string
optional default path
\Fuel\Core\Closure
function to custom render this type
object
current instanceassettype(string $type, mixed $files, array $attr, string $group, boolean $raw) : string | object
Either adds the asset to the group, or directly return the tag.
string
The asset type
mixed
The file name, or an array files.
array
An array of extra attributes
string
The asset group name
boolean
whether to return the raw file or not when group is not set (optional)
string
object
Rendered asset or current instance when adding to groupfind_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths.
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 foundget_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths, and return it relative to the docroot
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 foundremove_path(string $path, string $type) : object
string
the path to remove
string
optional path type (js, css or img)
object
current instancerender(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
\FuelException |
---|
string
the group's output_parse_assets(string $type, mixed $assets, array $attr, string $group, bool $raw) : string
Pareses the assets and adds them to the group
string
The asset type
mixed
The file name, or an array files.
array
An array of extra attributes
string
The asset group name
bool
string
_unify_path(string $path, mixed $ds, boolean $trailing) : string
make sure the directory separator in the path is correct for the platform used, is terminated with a directory separator, and all relative path references are removed
string
The path
mixed
Optional directory separator
boolean
Optional whether to add trailing directory separator
string
render_css($file, $attr, $inline) : string
string
render_img($file, $attr, $inline) : string
string
render_js($file, $attr, $inline) : string
string
$_add_mtime : bool
$_always_resolve : bool
$_asset_paths : array
$_asset_url : string
$_auto_render : bool
$_fail_silently : bool
$_groups : array
$_indent : string
$_path_folders : array
$_renderers : array