forge($config = array())
The forge method allows you to manually instantiate an asset instance.
Static | Yes | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
|||||||||
Returns | object - The instantiated asset object. | |||||||||
Example |
|
The asset class is a set of methods to help with the collection, grouping and displaying of assets (js, css, img, or custom types).
The Asset class supports the use of multiple instances. This might prove useful if you are using themes, where every theme has its own set of assets, or you are developing a modular application where each module provides its own set of assets.
In these cases, it would not be handy to have only a single instance and use search paths, since the chances of a duplicate asset name are quite high, causing your application to load the wrong asset.
You can use the same methods on an asset instance as you would when you the static methods. For the method definition see the class usage page.
The forge method allows you to manually instantiate an asset instance.
Static | Yes | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
|||||||||
Returns | object - The instantiated asset object. | |||||||||
Example |
|
The instance method allows you load a named instance of the asset class.
Static | Yes | ||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns | mixed - The named asset instance or false if the instance does not exist. | ||||||
Example |
|
The static methods of the Asset class will also use the default instance. Remember this if you alter the configuration (for example search paths) of the default instance!
The asset instance allows you to add custom types, so you can have it render other files or tags than only CSS, JS or IMG tags.
The add_type method allows to add custom types to be rendered by the Asset class at runtime.
Static | No | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||
Returns | string - The rendered HTML. | ||||||||||||
Example |
|