LaravelAsset_Container

Summary

No private methods found
No private properties found
N/A
File
asset.php
Package
Default
Class hierarchy
LaravelAsset_Container

Tags

None found

Properties

$name

$name : string

The asset container name.

Type

string

Tags

None found

$bundle

$bundle : string

The bundle that the assets belong to.

Type

string

Tags

None found

$assets

$assets : array

All of the registered assets.

Type

array

Tags

None found

Methods

__construct()

__construct(string  $name) : void

Create a new asset container instance.

Parameters

string $name

Tags

None found

add()

add(string  $name, string  $source, array  $dependencies = array(), array  $attributes = array()) : \Laravel\Asset_Container

Add an asset to the container.

The extension of the asset source will be used to determine the type of asset being registered (CSS or JavaScript). When using a non-standard extension, the style/script methods may be used to register assets.

// 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'));

Parameters

string $name
string $source
array $dependencies
array $attributes

Returns

LaravelAsset_Container

Tags

None found

style()

style(string  $name, string  $source, array  $dependencies = array(), array  $attributes = array()) : \Laravel\Asset_Container

Add a CSS file to the registered assets.

Parameters

string $name
string $source
array $dependencies
array $attributes

Returns

LaravelAsset_Container

Tags

None found

script()

script(string  $name, string  $source, array  $dependencies = array(), array  $attributes = array()) : \Laravel\Asset_Container

Add a JavaScript file to the registered assets.

Parameters

string $name
string $source
array $dependencies
array $attributes

Returns

LaravelAsset_Container

Tags

None found

path()

path(string  $source) : string

Returns the full-path for an asset.

Parameters

string $source

Returns

string

Tags

None found

bundle()

bundle(string  $bundle) : \Laravel\Asset_Container

Set the bundle that the container's assets belong to.

Parameters

string $bundle

Returns

LaravelAsset_Container

Tags

None found

styles()

styles() : string

Get the links to all of the registered CSS assets.

Returns

string

Tags

None found

scripts()

scripts() : string

Get the links to all of the registered JavaScript assets.

Returns

string

Tags

None found

register()

register(string  $type, string  $name, string  $source, array  $dependencies, array  $attributes) : void

Add an asset to the array of registered assets.

Parameters

string $type
string $name
string $source
array $dependencies
array $attributes

Tags

None found

group()

group(string  $group) : string

Get all of the registered assets for a given type / group.

Parameters

string $group

Returns

string

Tags

None found

asset()

asset(string  $group, string  $name) : string

Get the HTML link to a registered asset.

Parameters

string $group
string $name

Returns

string

Tags

None found

arrange()

arrange(array  $assets) : array

Sort and retrieve assets based on their dependencies

Parameters

array $assets

Returns

array

Tags

None found

evaluate_asset()

evaluate_asset(string  $asset, string  $value, array  $original, array  $sorted, array  $assets) : void

Evaluate an asset and its dependencies.

Parameters

string $asset
string $value
array $original
array $sorted
array $assets

Tags

None found

dependency_is_valid()

dependency_is_valid(string  $asset, string  $dependency, array  $original, array  $assets) : boolean

Verify that an asset's dependency is valid.

A dependency is considered valid if it exists, is not a circular reference, and is not a reference to the owning asset itself. If the dependency doesn't exist, no error or warning will be given. For the other cases, an exception is thrown.

Parameters

string $asset
string $dependency
array $original
array $assets

Returns

boolean

Tags

None found