FormPersistenceManager implements FormPersistenceManagerInterface
Concrete implementation of the FormPersistenceManagerInterface
Scope: frontend / backend
Table of Contents
Interfaces
- FormPersistenceManagerInterface
- The form persistence manager interface
Constants
- FORM_DEFINITION_FILE_EXTENSION = '.form.yaml'
Properties
- $filePersistenceSlot : FilePersistenceSlot
- $formSettings : array<string|int, mixed>
- $resourceFactory : ResourceFactory
- $runtimeCache : FrontendInterface
- $storageRepository : StorageRepository
- $typoScriptSettings : array<string|int, mixed>
- $yamlSource : YamlSource
Methods
- __construct() : mixed
- checkForDuplicateIdentifier() : bool
- Check if an identifier is already used by a formDefinition.
- delete() : mixed
- Delete the form representation identified by $persistenceIdentifier.
- exists() : bool
- Check whether a form with the specified $persistenceIdentifier exists
- getAccessibleExtensionFolders() : array<string|int, mixed>
- Return a list of all accessible extension folders
- getAccessibleFormStorageFolders() : array<string|int, Folder>
- Return a list of all accessible file mountpoints for the current backend user.
- getUniqueIdentifier() : string
- This takes a form identifier and returns a unique identifier for it.
- getUniquePersistenceIdentifier() : string
- This takes a form identifier and returns a unique persistence identifier for it.
- hasValidFileExtension() : bool
- isAllowedPersistencePath() : bool
- Check if a persistence path or if a persistence identifier path is configured within the form setup (persistenceManager.allowedExtensionPaths / persistenceManager.allowedFileMounts).
- listForms() : array<string|int, mixed>
- List all form definitions which can be loaded through this form persistence manager.
- load() : array<string|int, mixed>
- Load the array formDefinition identified by $persistenceIdentifier, override it by TypoScript settings, and return it. Only files with the extension .yaml or .form.yaml are loaded.
- retrieveYamlFilesFromExtensionFolders() : array<string, string>
- Retrieves yaml files from extension folders for further processing.
- retrieveYamlFilesFromStorageFolders() : array<string|int, File>
- Retrieves yaml files from storage folders for further processing.
- save() : mixed
- Save the array form representation identified by $persistenceIdentifier.
- ensureValidPersistenceIdentifier() : void
- extractMetaDataFromCouldBeFormDefinition() : array<string|int, mixed>
- generateErrorsIfFormDefinitionIsValidButHasInvalidFileExtension() : void
- getOrCreateFile() : File
- Returns a File object for a given $persistenceIdentifier.
- getStorageByUid() : ResourceStorage
- Returns a ResourceStorage for a given uid
- isAccessibleExtensionFolder() : bool
- isAccessibleFormStorageFolder() : bool
- isFileWithinAccessibleExtensionFolders() : bool
- isFileWithinAccessibleFormStorageFolders() : bool
- loadMetaData() : array<string|int, mixed>
- looksLikeAFormDefinition() : bool
- overrideByTypoScriptSettings() : array<string, mixed>
- Every formDefinition setting is overridable by TypoScript.
- pathIsIntendedAsExtensionPath() : bool
- pathIsIntendedAsFileMountPath() : bool
- retrieveFileByPersistenceIdentifier() : File
- sortForms() : array<string|int, mixed>
Constants
FORM_DEFINITION_FILE_EXTENSION
public
mixed
FORM_DEFINITION_FILE_EXTENSION
= '.form.yaml'
Properties
$filePersistenceSlot
protected
FilePersistenceSlot
$filePersistenceSlot
$formSettings
protected
array<string|int, mixed>
$formSettings
$resourceFactory
protected
ResourceFactory
$resourceFactory
$runtimeCache
protected
FrontendInterface
$runtimeCache
$storageRepository
protected
StorageRepository
$storageRepository
$typoScriptSettings
protected
array<string|int, mixed>
$typoScriptSettings
$yamlSource
protected
YamlSource
$yamlSource
Methods
__construct()
public
__construct(YamlSource $yamlSource, StorageRepository $storageRepository, FilePersistenceSlot $filePersistenceSlot, ResourceFactory $resourceFactory, ConfigurationManagerInterface $configurationManager, CacheManager $cacheManager) : mixed
Parameters
- $yamlSource : YamlSource
- $storageRepository : StorageRepository
- $filePersistenceSlot : FilePersistenceSlot
- $resourceFactory : ResourceFactory
- $configurationManager : ConfigurationManagerInterface
- $cacheManager : CacheManager
checkForDuplicateIdentifier()
Check if an identifier is already used by a formDefinition.
public
checkForDuplicateIdentifier(string $identifier) : bool
Parameters
- $identifier : string
Return values
booldelete()
Delete the form representation identified by $persistenceIdentifier.
public
delete(string $persistenceIdentifier) : mixed
Only files with the extension .form.yaml are removed.
Parameters
- $persistenceIdentifier : string
Tags
exists()
Check whether a form with the specified $persistenceIdentifier exists
public
exists(string $persistenceIdentifier) : bool
Parameters
- $persistenceIdentifier : string
Return values
bool —TRUE if a form with the given $persistenceIdentifier can be loaded, otherwise FALSE
getAccessibleExtensionFolders()
Return a list of all accessible extension folders
public
getAccessibleExtensionFolders() : array<string|int, mixed>
Only registered mountpoints from persistenceManager.allowedExtensionPaths are listed.
Return values
array<string|int, mixed>getAccessibleFormStorageFolders()
Return a list of all accessible file mountpoints for the current backend user.
public
getAccessibleFormStorageFolders() : array<string|int, Folder>
Only registered mountpoints from persistenceManager.allowedFileMounts are listed.
Return values
array<string|int, Folder>getUniqueIdentifier()
This takes a form identifier and returns a unique identifier for it.
public
getUniqueIdentifier(string $identifier) : string
If a formDefinition with the same identifier already exists a suffix is appended until the identifier is unique.
Parameters
- $identifier : string
Tags
Return values
string —unique form identifier
getUniquePersistenceIdentifier()
This takes a form identifier and returns a unique persistence identifier for it.
public
getUniquePersistenceIdentifier(string $formIdentifier, string $savePath) : string
By default this is just similar to the identifier. But if a form with the same persistence identifier already exists a suffix is appended until the persistence identifier is unique.
Parameters
- $formIdentifier : string
-
lowerCamelCased form identifier
- $savePath : string
Tags
Return values
string —unique form persistence identifier
hasValidFileExtension()
public
hasValidFileExtension(string $fileName) : bool
Parameters
- $fileName : string
only to be used within TYPO3 Core, not part of TYPO3 Core API
Return values
boolisAllowedPersistencePath()
Check if a persistence path or if a persistence identifier path is configured within the form setup (persistenceManager.allowedExtensionPaths / persistenceManager.allowedFileMounts).
public
isAllowedPersistencePath(string $persistencePath) : bool
If the input is a persistence identifier an additional check for a valid file extension will be performed. .
Parameters
- $persistencePath : string
Return values
boollistForms()
List all form definitions which can be loaded through this form persistence manager.
public
listForms() : array<string|int, mixed>
Returns an associative array with each item containing the keys 'name' (the human-readable name of the form) and 'persistenceIdentifier' (the unique identifier for the Form Persistence Manager e.g. the path to the saved form definition).
Return values
array<string|int, mixed> —in the format [['name' => 'Form 01', 'persistenceIdentifier' => 'path1'], [ .... ]]
load()
Load the array formDefinition identified by $persistenceIdentifier, override it by TypoScript settings, and return it. Only files with the extension .yaml or .form.yaml are loaded.
public
load(string $persistenceIdentifier) : array<string|int, mixed>
Parameters
- $persistenceIdentifier : string
Return values
array<string|int, mixed>retrieveYamlFilesFromExtensionFolders()
Retrieves yaml files from extension folders for further processing.
public
retrieveYamlFilesFromExtensionFolders() : array<string, string>
At this time it's not determined yet, whether these files contain form data.
Return values
array<string, string>retrieveYamlFilesFromStorageFolders()
Retrieves yaml files from storage folders for further processing.
public
retrieveYamlFilesFromStorageFolders() : array<string|int, File>
At this time it's not determined yet, whether these files contain form data.
Return values
array<string|int, File>save()
Save the array form representation identified by $persistenceIdentifier.
public
save(string $persistenceIdentifier, array<string|int, mixed> $formDefinition) : mixed
Only files with the extension .form.yaml are saved. If the formDefinition is located within an EXT: resource, save is only allowed if the configuration path persistenceManager.allowSaveToExtensionPaths is set to true.
Parameters
- $persistenceIdentifier : string
- $formDefinition : array<string|int, mixed>
Tags
ensureValidPersistenceIdentifier()
protected
ensureValidPersistenceIdentifier(string $persistenceIdentifier) : void
Parameters
- $persistenceIdentifier : string
Tags
extractMetaDataFromCouldBeFormDefinition()
protected
extractMetaDataFromCouldBeFormDefinition(string $maybeRawFormDefinition) : array<string|int, mixed>
Parameters
- $maybeRawFormDefinition : string
Return values
array<string|int, mixed>generateErrorsIfFormDefinitionIsValidButHasInvalidFileExtension()
protected
generateErrorsIfFormDefinitionIsValidButHasInvalidFileExtension(array<string|int, mixed> $formDefinition, string $persistenceIdentifier) : void
Parameters
- $formDefinition : array<string|int, mixed>
- $persistenceIdentifier : string
Tags
getOrCreateFile()
Returns a File object for a given $persistenceIdentifier.
protected
getOrCreateFile(string $persistenceIdentifier) : File
If no file for this identifier exists a new object will be created.
Parameters
- $persistenceIdentifier : string
Tags
Return values
FilegetStorageByUid()
Returns a ResourceStorage for a given uid
protected
getStorageByUid(int $storageUid) : ResourceStorage
Parameters
- $storageUid : int
Tags
Return values
ResourceStorageisAccessibleExtensionFolder()
protected
isAccessibleExtensionFolder(string $folderName) : bool
Parameters
- $folderName : string
Return values
boolisAccessibleFormStorageFolder()
protected
isAccessibleFormStorageFolder(string $folderName) : bool
Parameters
- $folderName : string
Return values
boolisFileWithinAccessibleExtensionFolders()
protected
isFileWithinAccessibleExtensionFolders(string $fileName) : bool
Parameters
- $fileName : string
Return values
boolisFileWithinAccessibleFormStorageFolders()
protected
isFileWithinAccessibleFormStorageFolders(string $fileName) : bool
Parameters
- $fileName : string
Return values
boolloadMetaData()
protected
loadMetaData(string|File $persistenceIdentifier) : array<string|int, mixed>
Parameters
- $persistenceIdentifier : string|File
Tags
Return values
array<string|int, mixed>looksLikeAFormDefinition()
protected
looksLikeAFormDefinition(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Return values
booloverrideByTypoScriptSettings()
Every formDefinition setting is overridable by TypoScript.
protected
overrideByTypoScriptSettings(array<string, mixed> $formDefinition) : array<string, mixed>
If the TypoScript configuration path
plugin.tx_form.settings.formDefinitionOverrides.
Parameters
- $formDefinition : array<string, mixed>
Return values
array<string, mixed>pathIsIntendedAsExtensionPath()
protected
pathIsIntendedAsExtensionPath(string $path) : bool
Parameters
- $path : string
Return values
boolpathIsIntendedAsFileMountPath()
protected
pathIsIntendedAsFileMountPath(string $path) : bool
Parameters
- $path : string
Return values
boolretrieveFileByPersistenceIdentifier()
protected
retrieveFileByPersistenceIdentifier(string $persistenceIdentifier) : File
Parameters
- $persistenceIdentifier : string
Tags
Return values
FilesortForms()
protected
sortForms(array<string|int, mixed> $forms) : array<string|int, mixed>
Parameters
- $forms : array<string|int, mixed>