PropertyMappingConfiguration implements AfterFormStateInitializedInterface

Scope: frontend

Internal
Attributes
#[Autoconfigure]
$public: true

Table of Contents

Interfaces

AfterFormStateInitializedInterface
Event is triggered with current form state and form session, which is not the case with e.g. `afterBuildingFinished`. Can be used to further enrich components with runtime state.

Methods

afterFormStateInitialized()  : void
adjustPropertyMappingForFileUploadsAtRuntime()  : void
Adjusts property mapping configuration for file upload elements at runtime.
registerMimeTypeValidator()  : void
Registers the MimeTypeValidator for the given file upload element based on its 'allowedMimeTypes' property.

Methods

afterFormStateInitialized()

public afterFormStateInitialized(FormRuntime $formRuntime) : void
Parameters
$formRuntime : FormRuntime

holding current form state and static form definition

adjustPropertyMappingForFileUploadsAtRuntime()

Adjusts property mapping configuration for file upload elements at runtime.

protected adjustPropertyMappingForFileUploadsAtRuntime(FormRuntime $formRuntime, RenderableInterface $renderable) : void

At this point, form definition properties (from YAML) are fully available, unlike in initializeFormElement() which runs before YAML properties are set.

This sets:

  • CONFIGURATION_UPLOAD_SEED: derived from the form session identifier for creating storage sub-folders.
  • CONFIGURATION_ALLOW_REMOVAL: from the element's 'allowRemoval' property to enable HMAC-signed file deletion.

It also registers the MimeTypeValidator based on the 'allowedMimeTypes' property. This must happen here (and not in FileUpload::initializeFormElement()) because the concrete form definition properties are only available at runtime.

Parameters
$formRuntime : FormRuntime
$renderable : RenderableInterface

registerMimeTypeValidator()

Registers the MimeTypeValidator for the given file upload element based on its 'allowedMimeTypes' property.

protected registerMimeTypeValidator(ProcessingRule $processingRule, FileUpload $renderable) : void

The validator is only added once, even if this method is called multiple times during a request.

Parameters
$processingRule : ProcessingRule
$renderable : FileUpload
On this page

Search results