GridDataService

readonly class \TYPO3\CMS\Workspaces\Service\GridDataService

Table of Contents

Methods

__construct()  : mixed
generateGridListFromVersions()  : array
Generates grid list array from given versions.
getRowDetails()  : array
addCollectionChildrenRecursive()  : void
Add collection children to the data array part recursively
calculateStartWithCollections()  : int
Calculate the "real" start value by also taking collection children into account
determineActions()  : array
The action buttons of a row, indexed by their identifier and rendered in the order and grouping given here. Listeners of AfterDataGeneratedForWorkspaceEvent turn an action off ('enabled'), remove it from the row ('visible') or add an own one ('icon', 'title', 'url'), which is why the default set is determined after that event has been dispatched and merged with what listeners provided. Actions the module does not know itself are rendered from the payload alone and are picked up by the JavaScript of the declaring extension via their 'data-action' attribute.
determineAdditionalColumns()  : array<string, string>
Additional columns are contributed by listeners of AfterDataGeneratedForWorkspaceEvent, which add an 'additional' section to the rows they want to enrich:
formatValue()  : string
generateDataArray()  : array
Generates grid list array from given versions.
getBackendUser()  : BackendUserAuthentication
getDataArray()  : array
Gets the data array by considering the page to be shown in the grid view.
getLanguageService()  : LanguageService
getLanguageValue()  : int
Gets the language value (system language uid) of a given database record
getSuitableFields()  : array
Gets the fields suitable for being displayed in new and delete diff views
getSystemLanguageValue()  : string|null
Gets a named value of an available system language
isPageModuleAllowed()  : bool
Checks whether the configured page module can be accessed by the current user.
prepareFileReferenceDifferences()  : array|null
Prepares difference view for file references.
resolveDataArrayDependencies()  : array
Resolves dependencies of nested structures and sort data elements considering these dependencies.
resolveFileReferences()  : FileReference[]
versionIsModified()  : bool
workspaceState()  : string
Gets the state of a given state value.

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher, ModuleProvider $moduleProvider, WorkspacePublishGate $workspacePublishGate, IntegrityService $integrityService, PreviewUriBuilder $previewUriBuilder, TcaSchemaFactory $tcaSchemaFactory, UriBuilder $uriBuilder, IconFactory $iconFactory, StagesService $stagesService, DiffUtility $diffUtility, HistoryService $historyService, ResourceFactory $resourceFactory, LoggerInterface $logger, FlexFormValueFormatter $flexFormValueFormatter, SearchableSchemaFieldsCollector $searchableSchemaFieldsCollector, VisibleSchemaFieldsCollector $visibleSchemaFieldsCollector, Avatar $avatar, TranslationConfigurationProvider $translationConfigurationProvider, CollectionService $dependencyCollectionService) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface
$moduleProvider : ModuleProvider
$workspacePublishGate : WorkspacePublishGate
$integrityService : IntegrityService
$previewUriBuilder : PreviewUriBuilder
$tcaSchemaFactory : TcaSchemaFactory
$uriBuilder : UriBuilder
$iconFactory : IconFactory
$stagesService : StagesService
$diffUtility : DiffUtility
$historyService : HistoryService
$resourceFactory : ResourceFactory
$logger : LoggerInterface
$flexFormValueFormatter : FlexFormValueFormatter
$searchableSchemaFieldsCollector : SearchableSchemaFieldsCollector
$visibleSchemaFieldsCollector : VisibleSchemaFieldsCollector
$avatar : Avatar
$translationConfigurationProvider : TranslationConfigurationProvider
$dependencyCollectionService : CollectionService

generateGridListFromVersions()

Generates grid list array from given versions.

public generateGridListFromVersions(WorkspaceStage[] $stages, array $versions, stdClass $parameter) : array

Parameters

$stages : WorkspaceStage[]
$versions : array

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

Return values

array —

Version record information (filtered, sorted and limited)

addCollectionChildrenRecursive()

Add collection children to the data array part recursively

protected addCollectionChildrenRecursive(array $dataArray, array $item, int &$recordsCount[, array &$dataArrayPart = [] ]) : void

Parameters

$dataArray : array
$item : array
$recordsCount : int
$dataArrayPart : array = []

calculateStartWithCollections()

Calculate the "real" start value by also taking collection children into account

protected calculateStartWithCollections(array $dataArray, int $start) : int

Parameters

$dataArray : array
$start : int

Return values

int

determineActions()

The action buttons of a row, indexed by their identifier and rendered in the order and grouping given here. Listeners of AfterDataGeneratedForWorkspaceEvent turn an action off ('enabled'), remove it from the row ('visible') or add an own one ('icon', 'title', 'url'), which is why the default set is determined after that event has been dispatched and merged with what listeners provided. Actions the module does not know itself are rendered from the payload alone and are picked up by the JavaScript of the declaring extension via their 'data-action' attribute.

protected determineActions(array $dataArray) : array

Parameters

$dataArray : array

Return values

array

determineAdditionalColumns()

Additional columns are contributed by listeners of AfterDataGeneratedForWorkspaceEvent, which add an 'additional' section to the rows they want to enrich:

protected determineAdditionalColumns(array $dataArray) : array<string, string>

$row['additional']['myColumn'] = ['label' => 'My column', 'value' => 'Some value', 'icon' => 'actions-clock'];

A column is rendered as soon as one row declares it, its label is taken from the first row that provides a non-empty one and falls back to the column identifier. The columns are determined from all rows of the workspace and not only from those of the current page, so the table header does not change while paging.

Parameters

$dataArray : array

Return values

array<string, string> —

Column labels, indexed by column identifier

formatValue()

protected formatValue(string $table, string $fieldName, string $value, int $uid, array $tcaConfiguration, array $fullRow) : string

Parameters

$table : string
$fieldName : string
$value : string
$uid : int
$tcaConfiguration : array
$fullRow : array

Return values

string

getDataArray()

Gets the data array by considering the page to be shown in the grid view.

protected getDataArray(array $dataArray, int $start, int $limit) : array

Parameters

$dataArray : array
$start : int
$limit : int

Return values

array

getLanguageValue()

Gets the language value (system language uid) of a given database record

protected getLanguageValue(TcaSchema $schema, array $record) : int

Parameters

$schema : TcaSchema
$record : array

Database record

Return values

int

getSuitableFields()

Gets the fields suitable for being displayed in new and delete diff views

protected getSuitableFields(string $table, array $row) : array

Parameters

$table : string
$row : array

Return values

array

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)

Return values

string|null

isPageModuleAllowed()

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

bool

prepareFileReferenceDifferences()

Prepares difference view for file references.

protected prepareFileReferenceDifferences(FileReference[] $liveFileReferences, FileReference[] $versionFileReferences, bool $useThumbnails) : array|null

Parameters

$liveFileReferences : FileReference[]
$versionFileReferences : FileReference[]
$useThumbnails : bool

Return values

array|null

resolveDataArrayDependencies()

Resolves dependencies of nested structures and sort data elements considering these dependencies.

protected resolveDataArrayDependencies(array $dataArray) : array

Parameters

$dataArray : array

Return values

array

workspaceState()

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

Return values

string
On this page