forge($config = array())
The forge method allows you to manually instantiate an asset instance.
Static | Yes | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
|||||||||
返り値 | object - The instantiated asset object. | |||||||||
例 |
|
The asset class is a set of methods to help with the collection, grouping and displaying of assets (js, css, img).
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 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
|||||||||
返り値 | object - The instantiated asset object. | |||||||||
例 |
|
The instance method allows you load a named instance of the asset class. If this instance does not exist, it will be forged using the configuration array passed.
Static | Yes | ||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
||||||
返り値 | mixed - The named asset instance or false if the instance does not exist. | ||||||
例 |
|
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!