PHP Class Neos\FluidAdaptor\View\TemplatePaths

Custom implementation for template paths resolving, one which differs from the base implementation in that it is capable of resolving template paths based on TypoScript configuration when given a package name, and is aware of the Frontend/Backend contexts of TYPO3.
Inheritance: extends TYPO3Fluid\Fluid\View\TemplatePaths
Afficher le fichier Open project: neos/flow-development-collection

Protected Properties

Свойство Type Description
$layoutRootPathPattern string
$options array
$packageManager Neos\Flow\Package\PackageManagerInterface
$partialRootPathPattern string
$patternReplacementVariables string[] A map of key => values to be replaced in path patterns.
$templateRootPathPattern string

Méthodes publiques

Méthode Description
__construct ( array $options = [] )
getLayoutPathAndFilename ( string $layoutName = 'Default' ) : string Resolve the path and file name of the layout file, based on $this->options['layoutPathAndFilename'] and $this->options['layoutPathAndFilenamePattern'].
getLayoutRootPaths ( ) : array
getOption ( string $optionName ) : mixed Get a specific option of this object
getPartialPathAndFilename ( string $partialName ) : string Resolve the partial path and filename based on $this->options['partialPathAndFilenamePattern'].
getPartialRootPaths ( )
getPatternReplacementVariables ( ) : string[]
getTemplateRootPathPattern ( ) : string
getTemplateRootPaths ( ) : array Resolves the template root to be used inside other paths.
injectPackageManager ( Neos\Flow\Package\PackageManagerInterface $packageManager )
resolveTemplateFileForControllerAndActionAndFormat ( string $controller, string $action, string $format = null ) : mixed | string Resolves a template file based on the given controller and action, together with eventually defined patternReplacementVariables.
setLayoutRootPath ( string $layoutRootPath )
setLayoutRootPathPattern ( string $layoutRootPathPattern )
setOption ( string $optionName, mixed $value ) : void Set a specific option of this object
setPartialRootPath ( string $partialRootPath )
setPartialRootPathPattern ( string $partialRootPathPattern )
setPatternReplacementVariables ( string[] $patternReplacementVariables )
setTemplateRootPath ( string $templateRootPath )
setTemplateRootPathPattern ( string $templateRootPathPattern )

Méthodes protégées

Méthode Description
createIdentifierForFile ( string $pathAndFilename, string $prefix ) : string Returns a unique identifier for the given file in the format ____ The SH1 hash is a checksum that is based on the file path and last modification date
expandGenericPathPattern ( string $pattern, array $patternReplacementVariables, boolean $bubbleControllerAndSubpackage, boolean $formatIsOptional ) : array Processes following placeholders inside $pattern: - "@templateRoot" - "@partialRoot" - "@layoutRoot" - "@subpackage" - "@controller" - "@format"
expandPatterns ( array $patterns, string $search, array $replacements ) : void Expands the given $patterns by adding an array element for each $replacement replacing occurrences of $search.
expandSubPackageAndController ( array $paths, string $controllerName, null $subPackageKey = null, boolean $bubbleControllerAndSubpackage = false ) : array
getPackagePath ( string $packageName ) : string
getPackagePrivateResourcesPath ( string $packageKey ) : string | null
replacePatternVariable ( array $paths, string $variableName, string $variableValue ) : array
sanitizePath ( string $path ) : string Sanitize a path, ensuring it is absolute and if a directory, suffixed by a trailing slash.

Method Details

__construct() public méthode

public __construct ( array $options = [] )
$options array

createIdentifierForFile() protected méthode

Returns a unique identifier for the given file in the format ____ The SH1 hash is a checksum that is based on the file path and last modification date
protected createIdentifierForFile ( string $pathAndFilename, string $prefix ) : string
$pathAndFilename string
$prefix string
Résultat string

expandGenericPathPattern() protected méthode

This method is used to generate "fallback chains" for file system locations where a certain Partial can reside. If $bubbleControllerAndSubpackage is FALSE and $formatIsOptional is FALSE, then the resulting array will only have one element with all the above placeholders replaced. If you set $bubbleControllerAndSubpackage to TRUE, then you will get an array with potentially many elements: The first element of the array is like above. The second element has the @ controller part set to "" (the empty string) The third element now has the @ controller part again stripped off, and has the last subpackage part stripped off as well. This continues until both "@subpackage" and "@controller" are empty. Example for $bubbleControllerAndSubpackage is TRUE, we have the MyCompany\MyPackage\MySubPackage\Controller\MyController as Controller Object Name and the current format is "html" If pattern is "@templateRoot/@subpackage/@controller/@action.@format", then the resulting array is: - "Resources/Private/Templates/MySubPackage/My/@action.html" - "Resources/Private/Templates/MySubPackage/@action.html" - "Resources/Private/Templates/@action.html" If you set $formatIsOptional to TRUE, then for any of the above arrays, every element will be duplicated - once with "@format" replaced by the current request format, and once with ."@format" stripped off.
protected expandGenericPathPattern ( string $pattern, array $patternReplacementVariables, boolean $bubbleControllerAndSubpackage, boolean $formatIsOptional ) : array
$pattern string Pattern to be resolved
$patternReplacementVariables array The variables to replace in the pattern
$bubbleControllerAndSubpackage boolean if TRUE, then we successively split off parts from "@controller" and "@subpackage" until both are empty.
$formatIsOptional boolean if TRUE, then half of the resulting strings will have ."@format" stripped off, and the other half will have it.
Résultat array unix style paths

expandPatterns() protected méthode

Expands the given $patterns by adding an array element for each $replacement replacing occurrences of $search.
protected expandPatterns ( array $patterns, string $search, array $replacements ) : void
$patterns array
$search string
$replacements array
Résultat void

expandSubPackageAndController() protected méthode

protected expandSubPackageAndController ( array $paths, string $controllerName, null $subPackageKey = null, boolean $bubbleControllerAndSubpackage = false ) : array
$paths array
$controllerName string
$subPackageKey null
$bubbleControllerAndSubpackage boolean
Résultat array

getLayoutPathAndFilename() public méthode

In case a layout has already been set with setLayoutPathAndFilename(), this method returns that path, otherwise a path and filename will be resolved using the layoutPathAndFilenamePattern.
public getLayoutPathAndFilename ( string $layoutName = 'Default' ) : string
$layoutName string Name of the layout to use. If none given, use "Default"
Résultat string Path and filename of layout files

getLayoutRootPaths() public méthode

public getLayoutRootPaths ( ) : array
Résultat array

getOption() public méthode

Get a specific option of this object
public getOption ( string $optionName ) : mixed
$optionName string
Résultat mixed

getPackagePath() protected méthode

protected getPackagePath ( string $packageName ) : string
$packageName string
Résultat string

getPackagePrivateResourcesPath() protected méthode

protected getPackagePrivateResourcesPath ( string $packageKey ) : string | null
$packageKey string
Résultat string | null

getPartialPathAndFilename() public méthode

Resolve the partial path and filename based on $this->options['partialPathAndFilenamePattern'].
public getPartialPathAndFilename ( string $partialName ) : string
$partialName string The name of the partial
Résultat string the full path which should be used. The path definitely exists.

getPartialRootPaths() public méthode

public getPartialRootPaths ( )

getPatternReplacementVariables() public méthode

public getPatternReplacementVariables ( ) : string[]
Résultat string[]

getTemplateRootPathPattern() public méthode

public getTemplateRootPathPattern ( ) : string
Résultat string

getTemplateRootPaths() public méthode

Resolves the template root to be used inside other paths.
public getTemplateRootPaths ( ) : array
Résultat array Path(s) to template root directory

injectPackageManager() public méthode

public injectPackageManager ( Neos\Flow\Package\PackageManagerInterface $packageManager )
$packageManager Neos\Flow\Package\PackageManagerInterface

replacePatternVariable() protected méthode

protected replacePatternVariable ( array $paths, string $variableName, string $variableValue ) : array
$paths array
$variableName string
$variableValue string
Résultat array

resolveTemplateFileForControllerAndActionAndFormat() public méthode

Resolves a template file based on the given controller and action, together with eventually defined patternReplacementVariables.
public resolveTemplateFileForControllerAndActionAndFormat ( string $controller, string $action, string $format = null ) : mixed | string
$controller string
$action string
$format string
Résultat mixed | string

sanitizePath() protected méthode

Sanitize a path, ensuring it is absolute and if a directory, suffixed by a trailing slash.
protected sanitizePath ( string $path ) : string
$path string
Résultat string

setLayoutRootPath() public méthode

public setLayoutRootPath ( string $layoutRootPath )
$layoutRootPath string

setLayoutRootPathPattern() public méthode

public setLayoutRootPathPattern ( string $layoutRootPathPattern )
$layoutRootPathPattern string

setOption() public méthode

Set a specific option of this object
public setOption ( string $optionName, mixed $value ) : void
$optionName string
$value mixed
Résultat void

setPartialRootPath() public méthode

public setPartialRootPath ( string $partialRootPath )
$partialRootPath string

setPartialRootPathPattern() public méthode

public setPartialRootPathPattern ( string $partialRootPathPattern )
$partialRootPathPattern string

setPatternReplacementVariables() public méthode

public setPatternReplacementVariables ( string[] $patternReplacementVariables )
$patternReplacementVariables string[]

setTemplateRootPath() public méthode

public setTemplateRootPath ( string $templateRootPath )
$templateRootPath string

setTemplateRootPathPattern() public méthode

public setTemplateRootPathPattern ( string $templateRootPathPattern )
$templateRootPathPattern string

Property Details

$layoutRootPathPattern protected_oe property

protected string $layoutRootPathPattern
Résultat string

$options protected_oe property

protected array $options
Résultat array

$packageManager protected_oe property

protected PackageManagerInterface,Neos\Flow\Package $packageManager
Résultat Neos\Flow\Package\PackageManagerInterface

$partialRootPathPattern protected_oe property

protected string $partialRootPathPattern
Résultat string

$patternReplacementVariables protected_oe property

A map of key => values to be replaced in path patterns.
protected string[] $patternReplacementVariables
Résultat string[]

$templateRootPathPattern protected_oe property

protected string $templateRootPathPattern
Résultat string