added better comments to the asset class.
This commit is contained in:
parent
7f5d047e1f
commit
23ccc0a6a4
|
@ -12,6 +12,14 @@ class Asset {
|
|||
/**
|
||||
* Get an asset container instance.
|
||||
*
|
||||
* <code>
|
||||
* // Get the default asset container
|
||||
* $container = Asset::container();
|
||||
*
|
||||
* // Get a named asset container
|
||||
* $container = Asset::container('footer');
|
||||
* </code>
|
||||
*
|
||||
* @param string $container
|
||||
* @return Asset_Container
|
||||
*/
|
||||
|
@ -27,6 +35,14 @@ public static function container($container = 'default')
|
|||
|
||||
/**
|
||||
* Magic Method for calling methods on the default Asset container.
|
||||
*
|
||||
* <code>
|
||||
* // Call the "styles" method on the default container
|
||||
* echo Asset::styles();
|
||||
*
|
||||
* // Call the "add" method on the default container
|
||||
* Asset::add('jquery', 'js/jquery.js');
|
||||
* </code>
|
||||
*/
|
||||
public static function __callStatic($method, $parameters)
|
||||
{
|
||||
|
@ -70,6 +86,17 @@ public function __construct($name)
|
|||
* asset being registered (CSS or JavaScript). If you are using a non-standard
|
||||
* extension, you may use the style or script methods to register assets.
|
||||
*
|
||||
* <code>
|
||||
* // Add an asset to the container
|
||||
* Asset::container()->add('jquery', 'js/jquery.js');
|
||||
*
|
||||
* // Add an asset that has dependencies on other assets
|
||||
* Asset::add('jquery', 'js/jquery.js', 'jquery-ui');
|
||||
*
|
||||
* // Add an asset that should have attributes applied to its tags
|
||||
* Asset::add('jquery', 'js/jquery.js', null, array('defer'));
|
||||
* </code>
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $source
|
||||
* @param array $dependencies
|
||||
|
@ -134,6 +161,8 @@ protected function register($type, $name, $source, $dependencies, $attributes)
|
|||
{
|
||||
$dependencies = (array) $dependencies;
|
||||
|
||||
$attributes = (array) $attributes;
|
||||
|
||||
$this->assets[$type][$name] = compact('source', 'dependencies', 'attributes');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue