__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.
stringthe path to add
stringoptional path type (js, css or img)
objectcurrent instanceadd_type(string $type, string $path, \Fuel\Core\Closure $renderer) : object
stringnew path type
stringoptional default path
\Fuel\Core\Closurefunction to custom render this type
objectcurrent 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.
stringThe asset type
mixedThe file name, or an array files.
arrayAn array of extra attributes
stringThe asset group name
booleanwhether to return the raw file or not when group is not set (optional)
stringobjectRendered asset or current instance when adding to groupfind_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths.
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 foundget_file(string $file, string $type, string $folder) : mixed
Locates a file in all the asset paths, and return it relative to the docroot
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 foundremove_path(string $path, string $type) : object
stringthe path to remove
stringoptional path type (js, css or img)
objectcurrent 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.
mixedthe group to render
boolwhether to return the raw file or not
\FuelException |
|---|
stringthe 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
stringThe asset type
mixedThe file name, or an array files.
arrayAn array of extra attributes
stringThe 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
stringThe path
mixedOptional directory separator
booleanOptional whether to add trailing directory separator
stringrender_css($file, $attr, $inline) : string
stringrender_img($file, $attr, $inline) : string
stringrender_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