PHP Class AssetCompress\View\Helper\AssetCompressHelper

Handle inclusion assets using the AssetCompress features for concatenating and compressing asset files.
Inheritance: extends Cake\View\Helper
Afficher le fichier Open project: markstory/asset_compress

Méthodes publiques

Свойство Type Description
$helpers array Helpers used.

Protected Properties

Свойство Type Description
$collection MiniAsset\AssetCollection AssetCollection for the current config set.
$config MiniAsset\AssetConfig Configuration object
$factory AssetCompress\Factory Factory for other AssetCompress objects.
$writer MiniAsset\Output\AssetWriter AssetWriter instance

Méthodes publiques

Méthode Description
__construct ( Cake\View\View $view, array $settings = [] ) : void Constructor - finds and parses the ini file the plugin uses.
assetConfig ( AssetConfig $config = null ) : AssetConfig | null Modify the runtime configuration of the helper.
css ( string $file, array $options = [] ) : string Create a CSS file. Will generate link tags for either the dynamic build controller, or the generated file if it exists.
exists ( string $file ) : boolean Check if a build exists (is defined and have at least one file) in the ini file.
inlineCss ( string $file ) : string Create a CSS file. Will generate inline style tags in production, or reference the dynamic build file in development
inlineScript ( string $file ) : string Create an inline script tag for a script asset. Will generate inline script tags in production, or reference the dynamic build file in development.
script ( string $file, array $options = [] ) : A Create a script tag for a script asset. Will generate script tags for either the dynamic build controller, or the generated file if it exists.
url ( string $file = null, boolean | array $full = false ) : string Get the URL for a given asset name.

Méthodes protégées

Méthode Description
_addExt ( string $file, string $ext ) : string Adds an extension if the file doesn't already end with it.
_getBuildName ( AssetTarget $build ) : string Get the build file name.
_getRoute ( AssetTarget $file, string $base ) : string Get the dynamic build path for an asset.
_relativizePath ( string $path ) : string Converts an absolute path into a web relative one.
collection ( ) : AssetCollection Get the AssetCollection
factory ( ) : Factory Get the AssetCompress factory based on the config object.
writer ( ) : AssetWriter Get the AssetWriter

Method Details

__construct() public méthode

Constructor - finds and parses the ini file the plugin uses.
public __construct ( Cake\View\View $view, array $settings = [] ) : void
$view Cake\View\View The view instance to use.
$settings array The settings for the helper.
Résultat void

_addExt() protected méthode

Adds an extension if the file doesn't already end with it.
protected _addExt ( string $file, string $ext ) : string
$file string Filename
$ext string Extension with .
Résultat string

_getBuildName() protected méthode

Generates filenames that are intended for production use with statically generated files.
protected _getBuildName ( AssetTarget $build ) : string
$build MiniAsset\AssetTarget The build being resolved.
Résultat string The resolved build name.

_getRoute() protected méthode

This generates URLs that work with the development dispatcher filter.
protected _getRoute ( AssetTarget $file, string $base ) : string
$file MiniAsset\AssetTarget The build file you want to make a url for.
$base string The base path to fetch a url with.
Résultat string Generated URL.

_relativizePath() protected méthode

Converts an absolute path into a web relative one.
protected _relativizePath ( string $path ) : string
$path string The path to convert
Résultat string A webroot relative string.

assetConfig() public méthode

Used as a get/set for the ini file values.
public assetConfig ( AssetConfig $config = null ) : AssetConfig | null
$config MiniAsset\AssetConfig The config instance to set.
Résultat MiniAsset\AssetConfig | null Either the current config object or null.

collection() protected méthode

Get the AssetCollection
protected collection ( ) : AssetCollection
Résultat MiniAsset\AssetCollection

css() public méthode

To create build files without configuration use addCss() Options: - All options supported by HtmlHelper::css() are supported. - raw - Set to true to get one link element for each file in the build.
public css ( string $file, array $options = [] ) : string
$file string A build target to include.
$options array An array of options for the stylesheet tag.
Résultat string A stylesheet tag

exists() public méthode

Check if a build exists (is defined and have at least one file) in the ini file.
public exists ( string $file ) : boolean
$file string Name of the build that will be checked if exists.
Résultat boolean True if the build file exists.

factory() protected méthode

Get the AssetCompress factory based on the config object.
protected factory ( ) : Factory
Résultat AssetCompress\Factory

inlineCss() public méthode

To create build files without configuration use addCss() Options: - All options supported by HtmlHelper::css() are supported.
public inlineCss ( string $file ) : string
$file string A build target to include.
Résultat string style tag

inlineScript() public méthode

To create build files without configuration use addScript() Options: - All options supported by HtmlHelper::css() are supported.
public inlineScript ( string $file ) : string
$file string A build target to include.
Résultat string script tag

script() public méthode

To create build files without configuration use addScript() Options: - All options supported by HtmlHelper::css() are supported. - raw - Set to true to get one script element for each file in the build.
public script ( string $file, array $options = [] ) : A
$file string A build target to include.
$options array An array of options for the script tag.
Résultat A script tag

url() public méthode

Takes an build filename, and returns the URL to that build file.
public url ( string $file = null, boolean | array $full = false ) : string
$file string The build file that you want a URL for.
$full boolean | array Whether or not the URL should have the full base path.
Résultat string The generated URL.

writer() protected méthode

Get the AssetWriter
protected writer ( ) : AssetWriter
Résultat MiniAsset\Output\AssetWriter

Property Details

$collection protected_oe property

AssetCollection for the current config set.
protected AssetCollection,MiniAsset $collection
Résultat MiniAsset\AssetCollection

$config protected_oe property

Configuration object
protected AssetConfig,MiniAsset $config
Résultat MiniAsset\AssetConfig

$factory protected_oe property

Factory for other AssetCompress objects.
protected Factory,AssetCompress $factory
Résultat AssetCompress\Factory

$helpers public_oe property

Helpers used.
public array $helpers
Résultat array

$writer protected_oe property

AssetWriter instance
protected AssetWriter,MiniAsset\Output $writer
Résultat MiniAsset\Output\AssetWriter