W3cubDocs

/Phalcon 2

Class Phalcon\Assets\Manager

Manages collections of CSS/Javascript assets

Methods

public __construct ([array $options])

Phalcon\Assets\Manager constructor

public Phalcon\Assets\Manager setOptions (array $options)

Sets the manager’s options

public array getOptions ()

Returns the manager’s options

public Phalcon\Assets\Manager useImplicitOutput (boolean $implicitOutput)

Sets if the HTML generated must be directly printed or returned

public Phalcon\Assets\Manager addCss (string $path, [boolean $local], [boolean $filter], [array $attributes])

Adds a Css resource to the ‘css’ collection

$assets->addCss('css/bootstrap.css');
$assets->addCss('http://bootstrap.my-cdn.com/style.css', false);

public Phalcon\Assets\Manager addJs (string $path, [boolean $local], [boolean $filter], [array $attributes])

Adds a javascript resource to the ‘js’ collection

$assets->addJs('scripts/jquery.js');
$assets->addJs('http://jquery.my-cdn.com/jquery.js', true);

public Phalcon\Assets\Manager addResourceByType (string $type, Phalcon\Assets\Resource $resource)

Adds a resource by its type

$assets->addResourceByType('css', new Phalcon\Assets\Resource\Css('css/style.css'));

public Phalcon\Assets\Manager addResource (Phalcon\Assets\Resource $resource)

Adds a raw resource to the manager

$assets->addResource(new Phalcon\Assets\Resource('css', 'css/style.css'));

public Phalcon\Assets\Manager set (string $id, Phalcon\Assets\Collection $collection)

Sets a collection in the Assets Manager

$assets->get('js', $collection);

public Phalcon\Assets\Collection get (string $id)

Returns a collection by its id

$scripts = $assets->get('js');

public Phalcon\Assets\Collection getCss ()

Returns the CSS collection of assets

public Phalcon\Assets\Collection getJs ()

Returns the CSS collection of assets

public Phalcon\Assets\Collection collection (string $name)

Creates/Returns a collection of resources

public output (Phalcon\Assets\Collection $collection, callback $callback, [string $type])

Traverses a collection calling the callback to generate its HTML

public outputCss ([string $collectionName])

Prints the HTML for CSS resources

public outputJs ([string $collectionName])

Prints the HTML for JS resources

© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Assets_Manager.html