PHP Class FluidTYPO3\Vhs\Asset

Class to create Assets in PHP. ### Examples: $asset = $this->objectManager->get('FluidTYPO3\\Vhs\\Asset'); OR you can use the static factory method which works anywhere including outside of Extbase. $asset = \FluidTYPO3\Vhs\Asset::getInstance(); $asset->setPath('fileadmin/test.js')->setStandalone(TRUE)->finalize(); Or simply: $this->objectManager->get('FluidTYPO3\\Vhs\\Asset')->setPath('...')->finalize(); And you can create clean instances: Depending on how you need to access the Asset afterwards, you will want wo switch between these methods. Or if you have all settings in an array (with members named according to the properties on this class: \FluidTYPO3\Vhs\Asset::createFromSettings($settings)->finalize(); Finally, if your Asset is file based, VHS can perform a few detections to set initial attributes like standalone, external (if file contains protocol), type (based on extension) and name (base name of file). \FluidTYPO3\Vhs\Asset::createFromFile($filePathAndFilename); \FluidTYPO3\Vhs\Asset::createFromUrl($urlToExternalFile); You can chain all setters on the class before finally calling finalize() to register the Asset (you can still modify the Asset afterwards, but an Asset that has not been finalize()'ed will never show up or be processed - which is a lot friendlier than requiring you to use remove() on unwanted Assets). > Note: the "createFrom..." suite of methods automatically calls finalize() > on your Asset just before returning it. You can of course keep modifying > the instance after it is returned - but when using a "createFrom"... method > VHS assumes you always want your Asset included in the output.
Inheritance: implements FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface
Afficher le fichier Open project: fluidtypo3/vhs Class Usage Examples

Protected Properties

Свойство Type Description
$configurationManager TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
$content string
$dependencies array
$external boolean
$fluid boolean
$movable boolean
$name string
$namedChunks boolean
$path string
$removed boolean
$rewrite boolean
$settings array
$standalone boolean
$type string
$variables array

Méthodes publiques

Méthode Description
assertAddNameCommentWithChunk ( ) : boolean Returns TRUE if settings specify that the name of each Asset should be placed above the built content when placed in merged Asset cache files.
assertAllowedInFooter ( ) : boolean
assertDebugEnabled ( ) : boolean Returns TRUE if the current Asset should be debugged as commanded by settings in TypoScript an/ord ViewHelper attributes.
assertFluidEnabled ( ) : boolean Returns TRUE of settings specify that the source of this Asset should be rendered as if it were a Fluid template, using variables from the "arguments" attribute
assertHasBeenRemoved ( ) : boolean
build ( ) : mixed Build this asset. Override this method in the specific implementation of an Asset in order to:
createFromContent ( string $content ) : Asset
createFromFile ( string $filePathAndFilename ) : Asset
createFromSettings ( array $settings ) : Asset
createFromUrl ( string $url ) : Asset
finalize ( ) : Asset
getAssetSettings ( ) : array
getContent ( ) : string
getDebugInformation ( ) : array Allows public access to debug this particular Asset instance later, when including the Asset in the page.
getDependencies ( ) : array
getExternal ( ) : boolean
getFluid ( ) : boolean
getInstance ( ) : Asset
getMovable ( ) : boolean
getName ( ) : string
getNamedChunks ( ) : boolean
getPath ( ) : string
getRemoved ( ) : boolean
getRewrite ( ) : boolean
getSettings ( ) : array Returns the settings used by this particular Asset during inclusion. Public access allows later inspection of the TypoScript values which were applied to the Asset.
getStandalone ( ) : boolean
getType ( ) : string
getVariables ( ) : array
injectConfigurationManager ( TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager ) : void
remove ( ) : Asset
render ( ) : mixed Render method
setContent ( string $content ) : Asset
setDependencies ( array $dependencies ) : Asset
setExternal ( boolean $external ) : Asset
setFluid ( boolean $fluid ) : Asset
setMovable ( boolean $movable )
setName ( string $name ) : Asset
setNamedChunks ( boolean $namedChunks ) : Asset
setPath ( string $path ) : Asset
setRemoved ( boolean $removed ) : Asset
setRewrite ( boolean $rewrite ) : Asset
setSettings ( array $settings ) : Asset
setStandalone ( boolean $standalone ) : Asset
setType ( string $type ) : Asset
setVariables ( array $variables ) : Asset

Method Details

assertAddNameCommentWithChunk() public méthode

Returns TRUE if settings specify that the name of each Asset should be placed above the built content when placed in merged Asset cache files.

assertAllowedInFooter() public méthode

public assertAllowedInFooter ( ) : boolean
Résultat boolean

assertDebugEnabled() public méthode

Returns TRUE if the current Asset should be debugged as commanded by settings in TypoScript an/ord ViewHelper attributes.
public assertDebugEnabled ( ) : boolean
Résultat boolean

assertFluidEnabled() public méthode

Returns TRUE of settings specify that the source of this Asset should be rendered as if it were a Fluid template, using variables from the "arguments" attribute
public assertFluidEnabled ( ) : boolean
Résultat boolean

assertHasBeenRemoved() public méthode

public assertHasBeenRemoved ( ) : boolean
Résultat boolean

build() public méthode

- if necessary compile the Asset (LESS, SASS, CoffeeScript etc) - make a final rendering decision based on arguments Note that within this function the ViewHelper and TemplateVariable Containers are not dependable, you cannot use the ControllerContext and RenderingContext and you should therefore also never call renderChildren from within this function. Anything else goes; CLI commands to build, caching implementations - you name it.
public build ( ) : mixed
Résultat mixed

createFromContent() public static méthode

public static createFromContent ( string $content ) : Asset
$content string
Résultat Asset

createFromFile() public static méthode

public static createFromFile ( string $filePathAndFilename ) : Asset
$filePathAndFilename string
Résultat Asset

createFromSettings() public static méthode

public static createFromSettings ( array $settings ) : Asset
$settings array
Résultat Asset

createFromUrl() public static méthode

public static createFromUrl ( string $url ) : Asset
$url string
Résultat Asset

finalize() public méthode

public finalize ( ) : Asset
Résultat Asset

getAssetSettings() public méthode

public getAssetSettings ( ) : array
Résultat array

getContent() public méthode

public getContent ( ) : string
Résultat string

getDebugInformation() public méthode

Allows public access to debug this particular Asset instance later, when including the Asset in the page.
public getDebugInformation ( ) : array
Résultat array

getDependencies() public méthode

public getDependencies ( ) : array
Résultat array

getExternal() public méthode

public getExternal ( ) : boolean
Résultat boolean

getFluid() public méthode

public getFluid ( ) : boolean
Résultat boolean

getInstance() public static méthode

public static getInstance ( ) : Asset
Résultat Asset

getMovable() public méthode

public getMovable ( ) : boolean
Résultat boolean

getName() public méthode

public getName ( ) : string
Résultat string

getNamedChunks() public méthode

public getNamedChunks ( ) : boolean
Résultat boolean

getPath() public méthode

public getPath ( ) : string
Résultat string

getRemoved() public méthode

public getRemoved ( ) : boolean
Résultat boolean

getRewrite() public méthode

public getRewrite ( ) : boolean
Résultat boolean

getSettings() public méthode

Returns the settings used by this particular Asset during inclusion. Public access allows later inspection of the TypoScript values which were applied to the Asset.
public getSettings ( ) : array
Résultat array

getStandalone() public méthode

public getStandalone ( ) : boolean
Résultat boolean

getType() public méthode

public getType ( ) : string
Résultat string

getVariables() public méthode

public getVariables ( ) : array
Résultat array

injectConfigurationManager() public méthode

public injectConfigurationManager ( TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager ) : void
$configurationManager TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Résultat void

remove() public méthode

public remove ( ) : Asset
Résultat Asset

render() public méthode

Render method
public render ( ) : mixed
Résultat mixed

setContent() public méthode

public setContent ( string $content ) : Asset
$content string
Résultat Asset

setDependencies() public méthode

public setDependencies ( array $dependencies ) : Asset
$dependencies array
Résultat Asset

setExternal() public méthode

public setExternal ( boolean $external ) : Asset
$external boolean
Résultat Asset

setFluid() public méthode

public setFluid ( boolean $fluid ) : Asset
$fluid boolean
Résultat Asset

setMovable() public méthode

public setMovable ( boolean $movable )
$movable boolean

setName() public méthode

public setName ( string $name ) : Asset
$name string
Résultat Asset

setNamedChunks() public méthode

public setNamedChunks ( boolean $namedChunks ) : Asset
$namedChunks boolean
Résultat Asset

setPath() public méthode

public setPath ( string $path ) : Asset
$path string
Résultat Asset

setRemoved() public méthode

public setRemoved ( boolean $removed ) : Asset
$removed boolean
Résultat Asset

setRewrite() public méthode

public setRewrite ( boolean $rewrite ) : Asset
$rewrite boolean
Résultat Asset

setSettings() public méthode

public setSettings ( array $settings ) : Asset
$settings array
Résultat Asset

setStandalone() public méthode

public setStandalone ( boolean $standalone ) : Asset
$standalone boolean
Résultat Asset

setType() public méthode

public setType ( string $type ) : Asset
$type string
Résultat Asset

setVariables() public méthode

public setVariables ( array $variables ) : Asset
$variables array
Résultat Asset

Property Details

$configurationManager protected_oe property

protected ConfigurationManagerInterface,TYPO3\CMS\Extbase\Configuration $configurationManager
Résultat TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface

$content protected_oe property

protected string $content
Résultat string

$dependencies protected_oe property

protected array $dependencies
Résultat array

$external protected_oe property

protected bool $external
Résultat boolean

$fluid protected_oe property

protected bool $fluid
Résultat boolean

$movable protected_oe property

protected bool $movable
Résultat boolean

$name protected_oe property

protected string $name
Résultat string

$namedChunks protected_oe property

protected bool $namedChunks
Résultat boolean

$path protected_oe property

protected string $path
Résultat string

$removed protected_oe property

protected bool $removed
Résultat boolean

$rewrite protected_oe property

protected bool $rewrite
Résultat boolean

$settings protected_oe property

protected array $settings
Résultat array

$standalone protected_oe property

protected bool $standalone
Résultat boolean

$type protected_oe property

protected string $type
Résultat string

$variables protected_oe property

protected array $variables
Résultat array