FormInlineAjaxController
readonly class \
- Extends
- AbstractFormEngineAjaxController
Handle FormEngine inline ajax calls
Attributes
- #[AsController]
Table of Contents
Methods
- __construct() : mixed
- createAction() : ResponseInterface
- Create a new inline child via AJAX.
- detailsAction() : ResponseInterface
- Show the details of a child record.
- expandOrCollapseAction() : ResponseInterface
- Store status of inline children expand / collapse state in backend user uC.
- synchronizeLocalizeAction() : ResponseInterface
- Adds localizations or synchronizes the locations of all child records.
- addJavaScriptModulesToJavaScriptItems() : void
- backendUserHasUcInlineView() : bool
- Method to check whether the backend user has the property inline view for the current IRRE item.
- compileChild() : array
- Compile a full child record
- compileChildChild() : array
- With useCombination set, not only content of the intermediate table, but also the connected child should be rendered in one go. Prepare this here.
- extractSignedParentConfigFromRequest() : array
- Validates the config that is transferred over the wire to provide the correct TCA config for the parent table
- getBackendUserAuthentication() : BackendUserAuthentication
- getChildChildTableName() : string
- The child-child table name is set in the child TCA "the selector field" and is depending on the TCA type (select or group) either the "foreign_table" or the (first) "allowed" table.
- getInlineExpandCollapseStateArray() : array
- Get expand / collapse state of inline items
- getInlineFirstPidFromDomObjectId() : int|string|null
- Get inlineFirstPid from a given objectId string
- getInlineRelatedRecordsUidArray() : array
- Gets an array with the uids of related records out of a list of items.
- getLabelsFromLocalizationFile() : array
- Parse a language file and get a label/value array from it.
- getLanguageService() : LanguageService|null
- getRelativePathToStylesheetFile() : string
- Resolve a CSS file position, possibly prefixed with 'EXT:'
- mergeChildResultIntoJsonResult() : array
- Merge stuff from child array into json array.
- removeFromArray() : array
- Remove an element from an array.
Methods
__construct()
public
__construct(FormDataCompiler $formDataCompiler, HashService $hashService, NodeFactory $nodeFactory, InlineStackProcessor $inlineStackProcessor, TcaSchemaFactory $tcaSchemaFactory, FlashMessageService $flashMessageService) : mixed
Parameters
- $formDataCompiler : FormDataCompiler
- $hashService : HashService
- $nodeFactory : NodeFactory
- $inlineStackProcessor : InlineStackProcessor
- $tcaSchemaFactory : TcaSchemaFactory
- $flashMessageService : FlashMessageService
createAction()
Create a new inline child via AJAX.
public
createAction(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfacedetailsAction()
Show the details of a child record.
public
detailsAction(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
Return values
ResponseInterfaceexpandOrCollapseAction()
Store status of inline children expand / collapse state in backend user uC.
public
expandOrCollapseAction(ServerRequestInterface $request) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
the incoming request
Return values
ResponseInterface —the filled response
synchronizeLocalizeAction()
Adds localizations or synchronizes the locations of all child records.
public
synchronizeLocalizeAction(ServerRequestInterface $request) : ResponseInterface
Handle AJAX calls to localize all records of a parent, localize a single record or to synchronize with the original language parent.
Parameters
- $request : ServerRequestInterface
-
the incoming request
Return values
ResponseInterface —the filled response
addJavaScriptModulesToJavaScriptItems()
protected
addJavaScriptModulesToJavaScriptItems(array $modules, JavaScriptItems $items) : void
Parameters
- $modules : array
- $items : JavaScriptItems
backendUserHasUcInlineView()
Method to check whether the backend user has the property inline view for the current IRRE item.
protected
backendUserHasUcInlineView(BackendUserAuthentication $backendUser) : bool
In existing or old IRRE items the attribute may not exist, then the json_decode will fail.
Parameters
- $backendUser : BackendUserAuthentication
Return values
boolcompileChild()
Compile a full child record
protected
compileChild(ServerRequestInterface $request, array $parentData, string $parentFieldName, int $childUid, array $inlineStructure) : array
Parameters
- $request : ServerRequestInterface
- $parentData : array
-
Result array of parent
- $parentFieldName : string
-
Name of parent field
- $childUid : int
-
Uid of child to compile
- $inlineStructure : array
-
Current inline structure
Tags
Return values
array —Full result array
compileChildChild()
With useCombination set, not only content of the intermediate table, but also the connected child should be rendered in one go. Prepare this here.
protected
compileChildChild(ServerRequestInterface $request, array $child, array $parentConfig, array $inlineStructure) : array
Parameters
- $request : ServerRequestInterface
- $child : array
-
Full data array of "mm" record
- $parentConfig : array
-
TCA configuration of "parent"
- $inlineStructure : array
-
Current inline structure
Return values
array —Full data array of child
extractSignedParentConfigFromRequest()
Validates the config that is transferred over the wire to provide the correct TCA config for the parent table
protected
extractSignedParentConfigFromRequest(string $contextString) : array
Parameters
- $contextString : string
Tags
Return values
arraygetBackendUserAuthentication()
protected
getBackendUserAuthentication() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetChildChildTableName()
The child-child table name is set in the child TCA "the selector field" and is depending on the TCA type (select or group) either the "foreign_table" or the (first) "allowed" table.
protected
getChildChildTableName(string $foreignSelector, array $childConfiguration) : string
Parameters
- $foreignSelector : string
- $childConfiguration : array
Return values
stringgetInlineExpandCollapseStateArray()
Get expand / collapse state of inline items
protected
getInlineExpandCollapseStateArray() : array
Return values
arraygetInlineFirstPidFromDomObjectId()
Get inlineFirstPid from a given objectId string
protected
getInlineFirstPidFromDomObjectId(string $domObjectId) : int|string|null
Parameters
- $domObjectId : string
-
The id attribute of an element
Return values
int|string|null —Pid or null
getInlineRelatedRecordsUidArray()
Gets an array with the uids of related records out of a list of items.
protected
getInlineRelatedRecordsUidArray(string $itemList) : array
This list could contain more information than required. This methods just extracts the uids.
Parameters
- $itemList : string
-
The list of related child records
Return values
array —An array with uids
getLabelsFromLocalizationFile()
Parse a language file and get a label/value array from it.
protected
getLabelsFromLocalizationFile(string $file) : array
Parameters
- $file : string
-
EXT:path/to/file
Return values
array —Label/value array
getLanguageService()
protected
getLanguageService() : LanguageService|null
Return values
LanguageService|nullgetRelativePathToStylesheetFile()
Resolve a CSS file position, possibly prefixed with 'EXT:'
protected
getRelativePathToStylesheetFile(string $stylesheetFile) : string
Parameters
- $stylesheetFile : string
-
Given file, possibly prefixed with EXT:
Return values
string —URL to file
mergeChildResultIntoJsonResult()
Merge stuff from child array into json array.
protected
mergeChildResultIntoJsonResult(array $jsonResult, array $childResult) : array
This method is needed since ajax handling methods currently need to put scriptCalls before and after child code.
Parameters
- $jsonResult : array
-
Given json result
- $childResult : array
-
Given child result
Return values
array —Merged json array
removeFromArray()
Remove an element from an array.
protected
removeFromArray(mixed $needle, array $haystack[, bool $strict = false ]) : array
Parameters
- $needle : mixed
-
The element to be removed.
- $haystack : array
-
The array the element should be removed from.
- $strict : bool = false
-
Search elements strictly.
Return values
array —The array $haystack without the $needle