FormManagerController extends ActionController
The form manager controller
Scope: backend
Table of Contents
Constants
- JS_MODULE_NAMES = ['app', 'viewModel']
- PAGINATION_MAX = 20
Properties
- $actionMethodName : non-empty-string
- Name of the action method
- $arguments : Arguments
- $charsetConverter : CharsetConverter
- $configurationManager : ConfigurationManagerInterface
- $coreUriBuilder : UriBuilder
- $databaseService : DatabaseService
- $defaultViewObjectName : class-string|null
- The default view class to use. Keep this 'null' for default fluid view, or set to 'JsonView::class' or some inheriting class.
- $errorMethodName : string
- Name of the special error action method which is called in case of errors
- $eventDispatcher : EventDispatcherInterface
- $extFormConfigurationManager : ConfigurationManagerInterface
- $fileHandlingService : FileHandlingService
- $formPersistenceManager : FormPersistenceManagerInterface
- $hashService : HashService
- $iconFactory : IconFactory
- $moduleTemplateFactory : ModuleTemplateFactory
- $mvcPropertyMappingConfigurationService : MvcPropertyMappingConfigurationService
- $pageRenderer : PageRenderer
- $reflectionService : ReflectionService
- $request : RequestInterface
- $responseFactory : ResponseFactoryInterface
- $settings : array<string|int, mixed>
- Contains the settings of the current extension
- $streamFactory : StreamFactoryInterface
- $translationService : TranslationService
- $uriBuilder : UriBuilder
- $validatorResolver : ValidatorResolver
- $view : ViewInterface
- The current view, as resolved by resolveView()
Methods
- __construct() : mixed
- addFlashMessage() : void
- Creates a Message object and adds it to the FlashMessageQueue.
- initializeControllerArgumentsBaseValidators() : void
- Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.
- injectConfigurationManager() : void
- injectEventDispatcher() : void
- injectFileHandlingService() : void
- injectHashService() : void
- injectInternalExtensionService() : void
- injectInternalFlashMessageService() : void
- injectMvcPropertyMappingConfigurationService() : void
- injectPropertyMapper() : void
- injectReflectionService() : void
- injectResponseFactory() : void
- injectStreamFactory() : void
- injectValidatorResolver() : void
- injectViewFactory() : void
- processRequest() : ResponseInterface
- Handles an incoming request and returns a response object
- throwStatus() : never
- Sends the specified HTTP status immediately and only stops to run back through the middleware stack.
- addBaseUriIfNecessary() : string
- Adds the base uri if not already in place.
- addErrorFlashMessage() : void
- If an error occurred during this request, this adds a flash message describing the error to the flash message container.
- callActionMethod() : ResponseInterface
- Calls the specified action method and passes the arguments.
- convertFormNameToIdentifier() : string
- Returns a form identifier which is the lower cased form name.
- createAction() : ResponseInterface
- Creates a new Form and redirects to the Form Editor
- deleteAction() : ResponseInterface
- Delete a formDefinition identified by the $formPersistenceIdentifier.
- duplicateAction() : ResponseInterface
- Duplicates a given formDefinition and redirects to the Form Editor
- errorAction() : ResponseInterface
- A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.
- forwardToReferringRequest() : ResponseInterface|null
- If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!
- getAccessibleFormStorageFolders() : array<string|int, mixed>
- Return a list of all accessible file mountpoints.
- getAvailableFormDefinitions() : array<string|int, mixed>
- List all formDefinitions which can be loaded through t form persistence manager. Enrich this data by a reference counter.
- getErrorFlashMessage() : bool|string
- A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.
- getFlashMessageQueue() : FlashMessageQueue
- todo: As soon as the incoming request contains the compiled plugin namespace, extbase will offer a trait to create a flash message identifier from the current request. Users then should inject the flash message service themselves if needed.
- getFlattenedValidationErrorMessage() : string
- Returns a string with a basic error message about validation failure.
- getFormManagerAppInitialData() : array<string|int, mixed>
- Returns the json encoded data which is used by the form editor JavaScript app.
- getFormSettings() : array<string|int, mixed>
- getLanguageService() : LanguageService
- getModuleUrl() : string
- Wrapper used for unit testing.
- getProcessedReferencesRows() : array<string|int, mixed>
- Returns an array with information about the references for a formDefinition identified by $persistenceIdentifier.
- getRecord() : array<string|int, mixed>|null
- Wrapper used for unit testing.
- handleArgumentMappingExceptions() : void
- This method processes exceptions that occur due to missing or not found targets or arguments during argument mapping. Based on configuration settings, either a "page not found" response is triggered or the original exception is propagated.
- htmlResponse() : ResponseInterface
- Returns a response object with either the given html string or the current rendered view as content.
- indexAction() : ResponseInterface
- Display the Form Manager. The main showing available forms.
- initializeAction() : void
- Initializes the controller before invoking an action method.
- initializeActionMethodArguments() : void
- Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action
- initializeActionMethodValidators() : void
- Adds the needed validators to the Arguments:
- initializeCreateAction() : void
- Initialize the "create" action.
- initializeDuplicateAction() : void
- Initialize the duplicate action.
- initializeModuleTemplate() : ModuleTemplate
- Init ModuleTemplate and register document header buttons
- initializeReferencesAction() : void
- Initialize the references action.
- isValidTemplatePath() : bool
- Check if a given $templatePath for a given $prototypeName is valid and accessible.
- jsonResponse() : ResponseInterface
- Returns a response object with either the given json string or the current rendered view as content. Mainly to be used for actions / controllers using the JsonView.
- mapRequestArgumentsToControllerArguments() : void
- Maps arguments delivered by the request object to the local controller arguments.
- redirect() : ResponseInterface
- Redirects the request to another action and / or controller.
- redirectToUri() : ResponseInterface
- Redirects the web request to another uri.
- referencesAction() : ResponseInterface
- Show references to this persistence identifier
- renderAssetsForRequest() : void
- Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.
- resolveActionMethodName() : string
- Resolves and checks the current action method name
- resolveView() : ViewInterface
- Prepares a view for the current action.
- valueContainsSearchTerm() : bool
Constants
JS_MODULE_NAMES
protected
mixed
JS_MODULE_NAMES
= ['app', 'viewModel']
PAGINATION_MAX
protected
mixed
PAGINATION_MAX
= 20
Properties
$actionMethodName
Name of the action method
protected
non-empty-string
$actionMethodName
= 'indexAction'
$arguments
protected
Arguments
$arguments
$charsetConverter read-only
protected
CharsetConverter
$charsetConverter
$configurationManager
protected
ConfigurationManagerInterface
$configurationManager
$coreUriBuilder read-only
protected
UriBuilder
$coreUriBuilder
$databaseService read-only
protected
DatabaseService
$databaseService
$defaultViewObjectName
The default view class to use. Keep this 'null' for default fluid view, or set to 'JsonView::class' or some inheriting class.
protected
class-string|null
$defaultViewObjectName
= null
$errorMethodName
Name of the special error action method which is called in case of errors
protected
string
$errorMethodName
= 'errorAction'
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$extFormConfigurationManager read-only
protected
ConfigurationManagerInterface
$extFormConfigurationManager
$fileHandlingService
protected
FileHandlingService
$fileHandlingService
$formPersistenceManager read-only
protected
FormPersistenceManagerInterface
$formPersistenceManager
$hashService
protected
HashService
$hashService
$iconFactory read-only
protected
IconFactory
$iconFactory
$moduleTemplateFactory read-only
protected
ModuleTemplateFactory
$moduleTemplateFactory
$mvcPropertyMappingConfigurationService
protected
MvcPropertyMappingConfigurationService
$mvcPropertyMappingConfigurationService
$pageRenderer read-only
protected
PageRenderer
$pageRenderer
$reflectionService
protected
ReflectionService
$reflectionService
$request
protected
RequestInterface
$request
$responseFactory
protected
ResponseFactoryInterface
$responseFactory
$settings
Contains the settings of the current extension
protected
array<string|int, mixed>
$settings
$streamFactory
protected
StreamFactoryInterface
$streamFactory
$translationService read-only
protected
TranslationService
$translationService
$uriBuilder
protected
UriBuilder
$uriBuilder
$validatorResolver
protected
ValidatorResolver
$validatorResolver
$view
The current view, as resolved by resolveView()
protected
ViewInterface
$view
Methods
__construct()
public
__construct(ModuleTemplateFactory $moduleTemplateFactory, PageRenderer $pageRenderer, IconFactory $iconFactory, DatabaseService $databaseService, FormPersistenceManagerInterface $formPersistenceManager, ConfigurationManagerInterface $extFormConfigurationManager, TranslationService $translationService, CharsetConverter $charsetConverter, UriBuilder $coreUriBuilder) : mixed
Parameters
- $moduleTemplateFactory : ModuleTemplateFactory
- $pageRenderer : PageRenderer
- $iconFactory : IconFactory
- $databaseService : DatabaseService
- $formPersistenceManager : FormPersistenceManagerInterface
- $extFormConfigurationManager : ConfigurationManagerInterface
- $translationService : TranslationService
- $charsetConverter : CharsetConverter
- $coreUriBuilder : UriBuilder
addFlashMessage()
Creates a Message object and adds it to the FlashMessageQueue.
public
addFlashMessage(string $messageBody[, string $messageTitle = '' ][, ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = true ]) : void
Parameters
- $messageBody : string
- $messageTitle : string = ''
- $severity : ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
- $storeInSession : bool = true
Tags
initializeControllerArgumentsBaseValidators()
Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.
public
initializeControllerArgumentsBaseValidators() : void
injectConfigurationManager()
public
injectConfigurationManager(ConfigurationManagerInterface $configurationManager) : void
Parameters
- $configurationManager : ConfigurationManagerInterface
injectEventDispatcher()
public
injectEventDispatcher(EventDispatcherInterface $eventDispatcher) : void
Parameters
- $eventDispatcher : EventDispatcherInterface
injectFileHandlingService()
public
injectFileHandlingService(FileHandlingService $fileHandlingService) : void
Parameters
- $fileHandlingService : FileHandlingService
injectHashService()
public
injectHashService(HashService $hashService) : void
Parameters
- $hashService : HashService
injectInternalExtensionService()
public
final injectInternalExtensionService(ExtensionService $extensionService) : void
Parameters
- $extensionService : ExtensionService
injectInternalFlashMessageService()
public
final injectInternalFlashMessageService(FlashMessageService $flashMessageService) : void
Parameters
- $flashMessageService : FlashMessageService
injectMvcPropertyMappingConfigurationService()
public
injectMvcPropertyMappingConfigurationService(MvcPropertyMappingConfigurationService $mvcPropertyMappingConfigurationService) : void
Parameters
- $mvcPropertyMappingConfigurationService : MvcPropertyMappingConfigurationService
injectPropertyMapper()
public
injectPropertyMapper(PropertyMapper $propertyMapper) : void
Parameters
- $propertyMapper : PropertyMapper
injectReflectionService()
public
injectReflectionService(ReflectionService $reflectionService) : void
Parameters
- $reflectionService : ReflectionService
injectResponseFactory()
public
final injectResponseFactory(ResponseFactoryInterface $responseFactory) : void
Parameters
- $responseFactory : ResponseFactoryInterface
injectStreamFactory()
public
final injectStreamFactory(StreamFactoryInterface $streamFactory) : void
Parameters
- $streamFactory : StreamFactoryInterface
injectValidatorResolver()
public
injectValidatorResolver(ValidatorResolver $validatorResolver) : void
Parameters
- $validatorResolver : ValidatorResolver
injectViewFactory()
public
final injectViewFactory(ViewFactoryInterface $viewFactory) : void
Parameters
- $viewFactory : ViewFactoryInterface
processRequest()
Handles an incoming request and returns a response object
public
processRequest(RequestInterface $request) : ResponseInterface
Parameters
- $request : RequestInterface
-
The request object
Return values
ResponseInterfacethrowStatus()
Sends the specified HTTP status immediately and only stops to run back through the middleware stack.
public
throwStatus(int $statusCode[, string $statusMessage = '' ][, string|null $content = null ]) : never
Note: If any other plugin or content or hook is used within a frontend request, this is skipped by design.
Parameters
- $statusCode : int
-
The HTTP status code
- $statusMessage : string = ''
-
A custom HTTP status message
- $content : string|null = null
-
Body content which further explains the status
Tags
Return values
neveraddBaseUriIfNecessary()
Adds the base uri if not already in place.
protected
addBaseUriIfNecessary(string $uri) : string
Parameters
- $uri : string
Return values
stringaddErrorFlashMessage()
If an error occurred during this request, this adds a flash message describing the error to the flash message container.
protected
addErrorFlashMessage() : void
callActionMethod()
Calls the specified action method and passes the arguments.
protected
callActionMethod(RequestInterface $request) : ResponseInterface
If the action returns a string, it is appended to the content in the response object. If the action doesn't return anything and a valid view exists, the view is rendered automatically.
Parameters
- $request : RequestInterface
Return values
ResponseInterfaceconvertFormNameToIdentifier()
Returns a form identifier which is the lower cased form name.
protected
convertFormNameToIdentifier(string $formName) : string
Parameters
- $formName : string
Return values
stringcreateAction()
Creates a new Form and redirects to the Form Editor
protected
createAction(string $formName, string $templatePath, string $prototypeName, string $savePath) : ResponseInterface
Parameters
- $formName : string
- $templatePath : string
- $prototypeName : string
- $savePath : string
Tags
Return values
ResponseInterfacedeleteAction()
Delete a formDefinition identified by the $formPersistenceIdentifier.
protected
deleteAction(string $formPersistenceIdentifier) : ResponseInterface
Parameters
- $formPersistenceIdentifier : string
Tags
Return values
ResponseInterfaceduplicateAction()
Duplicates a given formDefinition and redirects to the Form Editor
protected
duplicateAction(string $formName, string $formPersistenceIdentifier, string $savePath) : ResponseInterface
Parameters
- $formName : string
- $formPersistenceIdentifier : string
- $savePath : string
Tags
Return values
ResponseInterfaceerrorAction()
A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.
protected
errorAction() : ResponseInterface
The default implementation sets a flash message, request errors and forwards back to the originating action. This is suitable for most actions dealing with form input.
We clear the page cache by default on an error as well, as we need to make sure the data is re-evaluated when the user changes something.
Return values
ResponseInterfaceforwardToReferringRequest()
If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!
protected
forwardToReferringRequest() : ResponseInterface|null
Return values
ResponseInterface|nullgetAccessibleFormStorageFolders()
Return a list of all accessible file mountpoints.
protected
getAccessibleFormStorageFolders(array<string|int, mixed> $formSettings, bool $allowSaveToExtensionPaths) : array<string|int, mixed>
Only registered mount points from persistenceManager.allowedFileMounts are listed. This list will be reduced by the configured mount points for the current backend user.
Parameters
- $formSettings : array<string|int, mixed>
- $allowSaveToExtensionPaths : bool
Return values
array<string|int, mixed>getAvailableFormDefinitions()
List all formDefinitions which can be loaded through t form persistence manager. Enrich this data by a reference counter.
protected
getAvailableFormDefinitions(array<string|int, mixed> $formSettings[, string $searchTerm = '' ]) : array<string|int, mixed>
Parameters
- $formSettings : array<string|int, mixed>
- $searchTerm : string = ''
Return values
array<string|int, mixed>getErrorFlashMessage()
A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.
protected
getErrorFlashMessage() : bool|string
Returns either the flash message or "false" if no flash message should be set
Return values
bool|stringgetFlashMessageQueue()
todo: As soon as the incoming request contains the compiled plugin namespace, extbase will offer a trait to create a flash message identifier from the current request. Users then should inject the flash message service themselves if needed.
protected
getFlashMessageQueue([string|null $identifier = null ]) : FlashMessageQueue
Parameters
- $identifier : string|null = null
Return values
FlashMessageQueuegetFlattenedValidationErrorMessage()
Returns a string with a basic error message about validation failure.
protected
getFlattenedValidationErrorMessage() : string
We may add all validation error messages to a log file in the future, but for security reasons (@see #54074) we do not return these here.
Return values
stringgetFormManagerAppInitialData()
Returns the json encoded data which is used by the form editor JavaScript app.
protected
getFormManagerAppInitialData(array<string|int, mixed> $formSettings) : array<string|int, mixed>
Parameters
- $formSettings : array<string|int, mixed>
Return values
array<string|int, mixed>getFormSettings()
protected
getFormSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>getLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetModuleUrl()
Wrapper used for unit testing.
protected
getModuleUrl(string $moduleName[, array<string|int, mixed> $urlParameters = [] ]) : string
Parameters
- $moduleName : string
- $urlParameters : array<string|int, mixed> = []
Return values
stringgetProcessedReferencesRows()
Returns an array with information about the references for a formDefinition identified by $persistenceIdentifier.
protected
getProcessedReferencesRows(string $persistenceIdentifier) : array<string|int, mixed>
Parameters
- $persistenceIdentifier : string
Return values
array<string|int, mixed>getRecord()
Wrapper used for unit testing.
protected
getRecord(string $table, int $uid) : array<string|int, mixed>|null
Parameters
- $table : string
- $uid : int
Return values
array<string|int, mixed>|nullhandleArgumentMappingExceptions()
This method processes exceptions that occur due to missing or not found targets or arguments during argument mapping. Based on configuration settings, either a "page not found" response is triggered or the original exception is propagated.
protected
handleArgumentMappingExceptions(Exception $exception) : void
Extension authors can override this function to implement additional/custom argument mapping exception handling
Parameters
- $exception : Exception
htmlResponse()
Returns a response object with either the given html string or the current rendered view as content.
protected
htmlResponse([string|null $html = null ]) : ResponseInterface
Parameters
- $html : string|null = null
Return values
ResponseInterfaceindexAction()
Display the Form Manager. The main showing available forms.
protected
indexAction([int $page = 1 ][, string $searchTerm = '' ]) : ResponseInterface
Parameters
- $page : int = 1
- $searchTerm : string = ''
Return values
ResponseInterfaceinitializeAction()
Initializes the controller before invoking an action method.
protected
initializeAction() : void
Override this method to solve tasks which all actions have in common.
initializeActionMethodArguments()
Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action
protected
initializeActionMethodArguments() : void
Don't override this method - use initializeAction() instead.
Tags
initializeActionMethodValidators()
Adds the needed validators to the Arguments:
protected
initializeActionMethodValidators() : void
- Validators checking the data type from the param annotation
- Custom validators specified with validate annotations.
- Model-based validators (validate annotations in the model)
- Custom model validator classes
initializeCreateAction()
Initialize the "create" action.
protected
initializeCreateAction() : void
This action uses the Fluid JsonView::class as view.
initializeDuplicateAction()
Initialize the duplicate action.
protected
initializeDuplicateAction() : void
This action uses the Fluid JsonView::class as view.
initializeModuleTemplate()
Init ModuleTemplate and register document header buttons
protected
initializeModuleTemplate(ServerRequestInterface $request, int $page, string $searchTerm) : ModuleTemplate
Parameters
- $request : ServerRequestInterface
- $page : int
- $searchTerm : string
Return values
ModuleTemplateinitializeReferencesAction()
Initialize the references action.
protected
initializeReferencesAction() : void
This action uses the Fluid JsonView::class as view.
isValidTemplatePath()
Check if a given $templatePath for a given $prototypeName is valid and accessible.
protected
isValidTemplatePath(array<string|int, mixed> $formSettings, string $prototypeName, string $templatePath) : bool
Valid template paths has to be configured within formManager.selectablePrototypesConfiguration.[('identifier': $prototypeName)].newFormTemplates.[('templatePath': $templatePath)]
Parameters
- $formSettings : array<string|int, mixed>
- $prototypeName : string
- $templatePath : string
Return values
booljsonResponse()
Returns a response object with either the given json string or the current rendered view as content. Mainly to be used for actions / controllers using the JsonView.
protected
jsonResponse([string|null $json = null ]) : ResponseInterface
Parameters
- $json : string|null = null
Return values
ResponseInterfacemapRequestArgumentsToControllerArguments()
Maps arguments delivered by the request object to the local controller arguments.
protected
mapRequestArgumentsToControllerArguments() : void
redirect()
Redirects the request to another action and / or controller.
protected
redirect(string|null $actionName[, string|null $controllerName = null ][, string|null $extensionName = null ][, array<string|int, mixed>|null $arguments = null ][, int|null $pageUid = null ][, null $_ = null ][, int $statusCode = 303 ]) : ResponseInterface
Redirect will be sent to the client which then performs another request to the new URI.
Parameters
- $actionName : string|null
-
Name of the action to forward to
- $controllerName : string|null = null
-
Unqualified object name of the controller to forward to. If not specified, the current controller is used.
- $extensionName : string|null = null
-
Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.
- $arguments : array<string|int, mixed>|null = null
-
Arguments to pass to the target action
- $pageUid : int|null = null
-
Target page uid. If NULL, the current page uid is used
- $_ : null = null
-
(optional) Unused
- $statusCode : int = 303
-
(optional) The HTTP status code for the redirect. Default is "303 See Other
Return values
ResponseInterfaceredirectToUri()
Redirects the web request to another uri.
protected
redirectToUri(string|UriInterface $uri[, null $_ = null ][, int $statusCode = 303 ]) : ResponseInterface
Parameters
- $uri : string|UriInterface
-
A string representation of a URI
- $_ : null = null
-
(optional) Unused
- $statusCode : int = 303
-
(optional) The HTTP status code for the redirect. Default is "303 See Other"
Return values
ResponseInterfacereferencesAction()
Show references to this persistence identifier
protected
referencesAction(string $formPersistenceIdentifier) : ResponseInterface
Parameters
- $formPersistenceIdentifier : string
Tags
Return values
ResponseInterfacerenderAssetsForRequest()
Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.
protected
renderAssetsForRequest(RequestInterface $request) : void
This default implementation will attempt to render the sections "HeaderAssets" and "FooterAssets" from the template that is being rendered, inserting the rendered content into either page header or footer, as appropriate. Both sections are optional and can be used one or both in combination.
You can add assets with this method without worrying about duplicates, if for example you do this in a plugin that gets used multiple time on a page.
Parameters
- $request : RequestInterface
resolveActionMethodName()
Resolves and checks the current action method name
protected
resolveActionMethodName() : string
Tags
Return values
stringresolveView()
Prepares a view for the current action.
protected
resolveView() : ViewInterface
Tags
Return values
ViewInterfacevalueContainsSearchTerm()
protected
valueContainsSearchTerm(string $value, string $searchTerm) : bool
Parameters
- $value : string
- $searchTerm : string