GridDataService implements LoggerAwareInterface uses LoggerAwareTrait
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Interfaces
- LoggerAwareInterface
Constants
- GridColumn_Collection = 'Workspaces_Collection'
- GridColumn_CollectionChildren = 'Workspaces_CollectionChildren'
- GridColumn_CollectionCurrent = 'Workspaces_CollectionCurrent'
- GridColumn_CollectionLevel = 'Workspaces_CollectionLevel'
- GridColumn_CollectionParent = 'Workspaces_CollectionParent'
Properties
- $currentWorkspace : int
- Id of the current active workspace.
- $dataArray : array<string|int, mixed>
- Version record information (filtered, sorted and limited)
- $integrityService : IntegrityService|null
- $sort : string
- Name of the field used for sorting.
- $sortDir : string
- Direction used for sorting (ASC, DESC).
- $workspacesCache : FrontendInterface|null
Methods
- __construct() : mixed
- generateGridListFromVersions() : array<string|int, mixed>
- Generates grid list array from given versions.
- addCollectionChildrenRecursive() : void
- Add collection children to the data array part recursively
- calculateHash() : string
- Calculates the hash value of the used workspace, the user id, the versions array, the filter text, the sorting attribute, the workspace selected in grid and the sorting direction.
- calculateStartWithCollections() : int
- Calculate the "real" start value by also taking collection children into account
- generateDataArray() : void
- Generates grid list array from given versions.
- getBackendUser() : BackendUserAuthentication
- getDataArray() : array<string|int, mixed>
- Gets the data array by considering the page to be shown in the grid view.
- getDataArrayFromCache() : bool
- Checks if a cache entry is given for given versions and filter text and tries to load the data array from cache.
- getDependencyCollectionService() : CollectionService
- getIntegrityService() : IntegrityService
- Gets an instance of the integrity service.
- getLanguageValue() : int
- Gets the language value (system language uid) of a given database record
- getSystemLanguages() : array<string|int, mixed>
- Gets all available system languages.
- getSystemLanguageValue() : string|null
- Gets a named value of an available system language
- getTcaEnableColumnsFieldName() : string|null
- Gets the field name of the enable-columns as defined in $TCA.
- initializeWorkspacesCachingFramework() : void
- Initializes the workspace cache
- intSort() : int
- Implements individual sorting for columns based on integer comparison.
- isFilterTextInVisibleColumns() : bool
- Determines whether the text used to filter the results is part of a column that is visible in the grid view.
- isPageModuleAllowed() : bool
- Checks whether the configured page module can be accessed by the current user.
- isSortable() : bool
- Determines whether dataArray elements are sortable.
- resolveDataArrayDependencies() : void
- Resolves dependencies of nested structures and sort data elements considering these dependencies.
- setDataArrayIntoCache() : void
- Puts the generated dataArray into the workspace cache.
- sortDataArray() : void
- Performs sorting on the data array accordant to the selected column in the grid view to be used for sorting.
- stringSort() : int
- Implements individual sorting for columns based on string comparison.
- versionIsModified() : bool
- workspaceState() : string
- Gets the state of a given state value.
Constants
GridColumn_Collection
public
mixed
GridColumn_Collection
= 'Workspaces_Collection'
GridColumn_CollectionChildren
public
mixed
GridColumn_CollectionChildren
= 'Workspaces_CollectionChildren'
GridColumn_CollectionCurrent
public
mixed
GridColumn_CollectionCurrent
= 'Workspaces_CollectionCurrent'
GridColumn_CollectionLevel
public
mixed
GridColumn_CollectionLevel
= 'Workspaces_CollectionLevel'
GridColumn_CollectionParent
public
mixed
GridColumn_CollectionParent
= 'Workspaces_CollectionParent'
Properties
$currentWorkspace
Id of the current active workspace.
protected
int
$currentWorkspace
= 0
$dataArray
Version record information (filtered, sorted and limited)
protected
array<string|int, mixed>
$dataArray
= []
$integrityService
protected
IntegrityService|null
$integrityService
$sort
Name of the field used for sorting.
protected
string
$sort
= ''
$sortDir
Direction used for sorting (ASC, DESC).
protected
string
$sortDir
= ''
$workspacesCache
protected
FrontendInterface|null
$workspacesCache
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, WorkspaceService $workspaceService, ModuleProvider $moduleProvider, WorkspacePublishGate $workspacePublishGate) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $workspaceService : WorkspaceService
- $moduleProvider : ModuleProvider
- $workspacePublishGate : WorkspacePublishGate
generateGridListFromVersions()
Generates grid list array from given versions.
public
generateGridListFromVersions(array<string|int, mixed> $versions, stdClass $parameter, int $currentWorkspace) : array<string|int, mixed>
Parameters
- $versions : array<string|int, mixed>
-
All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
- $parameter : stdClass
-
Parameters as submitted by JavaScript component
- $currentWorkspace : int
-
The current workspace
Return values
array<string|int, mixed> —Version record information (filtered, sorted and limited)
addCollectionChildrenRecursive()
Add collection children to the data array part recursively
protected
addCollectionChildrenRecursive(array<string|int, mixed> $item, int &$recordsCount[, array<string|int, mixed> &$dataArrayPart = [] ]) : void
Parameters
- $item : array<string|int, mixed>
- $recordsCount : int
- $dataArrayPart : array<string|int, mixed> = []
calculateHash()
Calculates the hash value of the used workspace, the user id, the versions array, the filter text, the sorting attribute, the workspace selected in grid and the sorting direction.
protected
calculateHash(array<string|int, mixed> $versions, string $filterTxt) : string
Parameters
- $versions : array<string|int, mixed>
-
All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
- $filterTxt : string
-
The given filter text from the grid.
Return values
stringcalculateStartWithCollections()
Calculate the "real" start value by also taking collection children into account
protected
calculateStartWithCollections(int $start) : int
Parameters
- $start : int
Return values
intgenerateDataArray()
Generates grid list array from given versions.
protected
generateDataArray(array<string|int, mixed> $versions, string $filterTxt) : void
Parameters
- $versions : array<string|int, mixed>
-
All available version records
- $filterTxt : string
-
Text to be used to filter record result
getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetDataArray()
Gets the data array by considering the page to be shown in the grid view.
protected
getDataArray(int $start, int $limit) : array<string|int, mixed>
Parameters
- $start : int
- $limit : int
Return values
array<string|int, mixed>getDataArrayFromCache()
Checks if a cache entry is given for given versions and filter text and tries to load the data array from cache.
protected
getDataArrayFromCache(array<string|int, mixed> $versions, string $filterTxt) : bool
Parameters
- $versions : array<string|int, mixed>
-
All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
- $filterTxt : string
-
The given filter text from the grid.
Return values
bool —TRUE if cache entry was successfully fetched from cache and content put to $this->dataArray
getDependencyCollectionService()
protected
getDependencyCollectionService() : CollectionService
Return values
CollectionServicegetIntegrityService()
Gets an instance of the integrity service.
protected
getIntegrityService() : IntegrityService
Return values
IntegrityServicegetLanguageValue()
Gets the language value (system language uid) of a given database record
protected
getLanguageValue(string $table, array<string|int, mixed> $record) : int
Parameters
- $table : string
-
Name of the table
- $record : array<string|int, mixed>
-
Database record
Return values
intgetSystemLanguages()
Gets all available system languages.
protected
getSystemLanguages(int $pageId) : array<string|int, mixed>
Parameters
- $pageId : int
Return values
array<string|int, mixed>getSystemLanguageValue()
Gets a named value of an available system language
protected
getSystemLanguageValue(int $id, int $pageId, string $key) : string|null
Parameters
- $id : int
-
system language uid
- $pageId : int
-
page id of a site
- $key : string
-
Name of the value to be fetched (e.g. title)
Tags
Return values
string|nullgetTcaEnableColumnsFieldName()
Gets the field name of the enable-columns as defined in $TCA.
protected
getTcaEnableColumnsFieldName(string $table, string $type) : string|null
Parameters
- $table : string
-
Name of the table
- $type : string
-
Type to be fetches (e.g. 'disabled', 'starttime', 'endtime', 'fe_group)
Return values
string|null —The accordant field name or NULL if not defined
initializeWorkspacesCachingFramework()
Initializes the workspace cache
protected
initializeWorkspacesCachingFramework() : void
intSort()
Implements individual sorting for columns based on integer comparison.
protected
intSort(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
- $a : array<string|int, mixed>
- $b : array<string|int, mixed>
Return values
intisFilterTextInVisibleColumns()
Determines whether the text used to filter the results is part of a column that is visible in the grid view.
protected
isFilterTextInVisibleColumns(string $filterText, array<string|int, mixed> $versionArray) : bool
Parameters
- $filterText : string
- $versionArray : array<string|int, mixed>
Return values
boolisPageModuleAllowed()
Checks whether the configured page module can be accessed by the current user.
protected
isPageModuleAllowed() : bool
Note that this does not check whether a custom page module is configured correctly.
Return values
boolisSortable()
Determines whether dataArray elements are sortable.
protected
isSortable(array<string|int, mixed> $a, array<string|int, mixed> $b) : bool
Only elements on the first level (0) or below the same parent element are directly sortable.
Parameters
- $a : array<string|int, mixed>
- $b : array<string|int, mixed>
Return values
boolresolveDataArrayDependencies()
Resolves dependencies of nested structures and sort data elements considering these dependencies.
protected
resolveDataArrayDependencies() : void
setDataArrayIntoCache()
Puts the generated dataArray into the workspace cache.
protected
setDataArrayIntoCache(array<string|int, mixed> $versions, string $filterTxt) : void
Parameters
- $versions : array<string|int, mixed>
-
All records uids etc. First key is table name, second key incremental integer. Records are associative arrays with uid and t3ver_oid fields. The pid of the online record is found as "livepid" the pid of the offline record is found in "wspid
- $filterTxt : string
-
The given filter text from the grid.
sortDataArray()
Performs sorting on the data array accordant to the selected column in the grid view to be used for sorting.
protected
sortDataArray() : void
stringSort()
Implements individual sorting for columns based on string comparison.
protected
stringSort(array<string|int, mixed> $a, array<string|int, mixed> $b) : int
Parameters
- $a : array<string|int, mixed>
- $b : array<string|int, mixed>
Return values
intversionIsModified()
protected
versionIsModified(CombinedRecord $combinedRecord) : bool
Parameters
- $combinedRecord : CombinedRecord
Return values
boolworkspaceState()
Gets the state of a given state value.
protected
workspaceState(int $stateId[, bool $hiddenOnline = false ][, bool $hiddenOffline = false ][, bool $hasDiff = true ]) : string
Parameters
- $stateId : int
-
stateId of offline record
- $hiddenOnline : bool = false
-
hidden status of online record
- $hiddenOffline : bool = false
-
hidden status of offline record
- $hasDiff : bool = true
-
whether the version has any changes