PHP Class FluidTYPO3\Vhs\Service\AssetService

Inject this Service in your class to access VHS Asset features - include assets etc.
Inheritance: implements TYPO3\CMS\Core\SingletonInterface
Exibir arquivo Open project: fluidtypo3/vhs

Protected Properties

Property Type Description
$cacheCleared boolean
$cachedDependencies array
$configurationManager TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
$objectManager TYPO3\CMS\Extbase\Object\ObjectManagerInterface
$settingsCache array
$typoScriptAssetsBuilt boolean

Public Methods

Method Description
buildAll ( array $parameters, object $caller, boolean $cached = true ) : void
buildAllUncached ( array $parameters, object $caller ) : void
clearCacheCommand ( array $parameters ) : void
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.
injectConfigurationManager ( TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager ) : void
injectObjectManager ( TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager ) : void
usePageCache ( object $caller, boolean $shouldUsePageCache ) : boolean

Protected Methods

Method Description
assertAssetAllowedInFooter ( mixed $asset ) : boolean
buildAsset ( mixed $asset ) : string
buildAssetsChunk ( array $assets ) : string
copyReferencedFilesAndReplacePaths ( string $contents, string $regex, string $originalDirectory, string $wrap = '|' ) : string Finds and replaces all URLs by using a given regex
detectAndCopyFileReferences ( string $contents, string $originalDirectory ) : string Fixes the relative paths inside of url() references in CSS files
extractAssetContent ( mixed $asset ) : string
extractAssetSettings ( mixed $asset ) : array
generateTagForAssetType ( string $type, string $content, string $file = null, string $integrity = null ) : string
getFileIntegrity ( $file ) : string
insertAssetsAtMarker ( string $markerName, mixed $assets ) : void
manipulateAssetsByTypoScriptSettings ( array $assets ) : array
mergeArrays ( $array1, $array2 ) : array
placeAssetsInHeaderAndFooter ( FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[] $assets, boolean $cached ) : void
prefixPath ( string $fileRelativePathAndFilename ) : string Prefix a path according to "absRefPrefix" TS configuration.
renderAssetAsFluidTemplate ( mixed $asset ) : string
sortAssetsByDependency ( FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[] $assets ) : FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[]
writeCachedMergedFileAndReturnTag ( FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[] $assets, string $type ) : string
writeFile ( string $file, string $contents )

Method Details

assertAssetAllowedInFooter() protected method

protected assertAssetAllowedInFooter ( mixed $asset ) : boolean
$asset mixed An Asset ViewHelper instance or an array containing an Asset definition
return boolean

buildAll() public method

public buildAll ( array $parameters, object $caller, boolean $cached = true ) : void
$parameters array
$caller object
$cached boolean If TRUE, treats this inclusion as happening in a cached context
return void

buildAllUncached() public method

public buildAllUncached ( array $parameters, object $caller ) : void
$parameters array
$caller object
return void

buildAsset() protected method

protected buildAsset ( mixed $asset ) : string
$asset mixed An Asset ViewHelper instance or an array containing an Asset definition
return string

buildAssetsChunk() protected method

protected buildAssetsChunk ( array $assets ) : string
$assets array
return string

clearCacheCommand() public method

public clearCacheCommand ( array $parameters ) : void
$parameters array
return void

copyReferencedFilesAndReplacePaths() protected method

Finds and replaces all URLs by using a given regex
protected copyReferencedFilesAndReplacePaths ( string $contents, string $regex, string $originalDirectory, string $wrap = '|' ) : string
$contents string Data to process
$regex string Regex used to find URLs in content
$originalDirectory string Original location to CSS file, if file based.
$wrap string Wrap around replaced values
return string Processed data

detectAndCopyFileReferences() protected method

Fixes the relative paths inside of url() references in CSS files
protected detectAndCopyFileReferences ( string $contents, string $originalDirectory ) : string
$contents string Data to process
$originalDirectory string Original location of file
return string Processed data

extractAssetContent() protected method

protected extractAssetContent ( mixed $asset ) : string
$asset mixed
return string

extractAssetSettings() protected method

protected extractAssetSettings ( mixed $asset ) : array
$asset mixed An Asset ViewHelper instance or an array containing an Asset definition
return array

generateTagForAssetType() protected method

protected generateTagForAssetType ( string $type, string $content, string $file = null, string $integrity = null ) : string
$type string
$content string
$file string
$integrity string
return string

getFileIntegrity() protected method

protected getFileIntegrity ( $file ) : string
$file
return string

getSettings() public method

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
return array

injectConfigurationManager() public method

public injectConfigurationManager ( TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager ) : void
$configurationManager TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
return void

injectObjectManager() public method

public injectObjectManager ( TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager ) : void
$objectManager TYPO3\CMS\Extbase\Object\ObjectManagerInterface
return void

insertAssetsAtMarker() protected method

protected insertAssetsAtMarker ( string $markerName, mixed $assets ) : void
$markerName string
$assets mixed
return void

manipulateAssetsByTypoScriptSettings() protected method

protected manipulateAssetsByTypoScriptSettings ( array $assets ) : array
$assets array
return array

mergeArrays() protected method

protected mergeArrays ( $array1, $array2 ) : array
$array1
$array2
return array

placeAssetsInHeaderAndFooter() protected method

protected placeAssetsInHeaderAndFooter ( FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[] $assets, boolean $cached ) : void
$assets FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[]
$cached boolean
return void

prefixPath() protected method

Prefix a path according to "absRefPrefix" TS configuration.
protected prefixPath ( string $fileRelativePathAndFilename ) : string
$fileRelativePathAndFilename string
return string

renderAssetAsFluidTemplate() protected method

protected renderAssetAsFluidTemplate ( mixed $asset ) : string
$asset mixed
return string

sortAssetsByDependency() protected method

protected sortAssetsByDependency ( FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[] $assets ) : FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[]
$assets FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[]
return FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[]

usePageCache() public method

public usePageCache ( object $caller, boolean $shouldUsePageCache ) : boolean
$caller object
$shouldUsePageCache boolean
return boolean

writeCachedMergedFileAndReturnTag() protected method

protected writeCachedMergedFileAndReturnTag ( FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[] $assets, string $type ) : string
$assets FluidTYPO3\Vhs\ViewHelpers\Asset\AssetInterface[]
$type string
return string

writeFile() protected method

protected writeFile ( string $file, string $contents )
$file string
$contents string

Property Details

$cacheCleared protected_oe static_oe property

protected static bool $cacheCleared
return boolean

$cachedDependencies protected_oe static_oe property

protected static array $cachedDependencies
return array

$configurationManager protected_oe property

protected ConfigurationManagerInterface,TYPO3\CMS\Extbase\Configuration $configurationManager
return TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface

$objectManager protected_oe property

protected ObjectManagerInterface,TYPO3\CMS\Extbase\Object $objectManager
return TYPO3\CMS\Extbase\Object\ObjectManagerInterface

$settingsCache protected_oe static_oe property

protected static array $settingsCache
return array

$typoScriptAssetsBuilt protected_oe static_oe property

protected static bool $typoScriptAssetsBuilt
return boolean