AbstractItemProvider
abstract class \
Contains methods used by Data providers that handle elements with single items like select, radio and some more.
Table of Contents
Methods
- addIconFromAltIcons() : array
- Add alternative icon using "altIcons" TSconfig
- injectConnectionPool() : void
- injectEnvPlaceholderProcessor() : void
- injectFileRepository() : void
- injectFlashMessageService() : void
- injectIconFactory() : void
- injectItemProcessingService() : void
- sanitizeItemArray() : array
- Sanitize incoming item array
- translateLabels() : array
- Translate the item labels
- addItemsFromFolder() : array
- TCA config "fileFolder" evaluation. Add them to $items
- addItemsFromForeignTable() : array
- TCA config "foreign_table" evaluation. Add them to $items
- addItemsFromPageTsConfig() : array
- Page TSconfig addItems:
- buildForeignTableQueryBuilder() : QueryBuilder
- Build wrapped QueryBuilder to fetch full foreign records. Helper method of {@see self::fetchForeignTableRows()}, do not call otherwise.
- fetchForeignTableRows() : (array|false)[]
- Fetch one batch with workspace overlays. Leave delete placeholders in the result so callers can use the row count to decide whether to fetch more.
- getBackendUser() : BackendUserAuthentication
- getLanguageService() : LanguageService
- getLiveUid() : int|string
- Gets the record uid of the live default record. If already pointing to the live record, the submitted record uid is returned.
- hasSelectableTreeItems() : bool
- Check tree-field visibility without changing its raw TCA items or building labels, icons and full item rows. Shared by selectTree and category fields.
- parseSiteConfiguration() : array
- Parse ###SITE:### placeholders in the input string and return the replacements array for later use in $this->replaceParsedSiteConfiguration().
- parseStartingPointsFromMarkers() : array
- A field's [treeConfig][startingPoints] may contain markers, resolve them.
- parseStartingPointsFromSiteConfiguration() : array
- A field's [treeConfig][startingPoints] can be set via site config, parse possibly set values
- processDatabaseFieldValue() : array
- Convert the current database values into an array
- processForeignTableClause() : array
- Replace markers in a where clause from TCA foreign_table_where
- processSelectFieldValue() : array
- Validate and sanitize database row values of the select field with the given name.
- quoteParsedSiteConfiguration() : array
- removeItemsByDoktypeUserRestriction() : array
- Remove items if doktype is handled for non admin users
- removeItemsByKeepItemsPageTsConfig() : array
- Remove items using "keepItems" pageTsConfig
- removeItemsByRemoveItemsPageTsConfig() : array
- Remove items using "removeItems" pageTsConfig
- removeItemsByUserAuthMode() : array
- Remove items by user restriction on authMode items
- removeItemsByUserLanguageFieldRestriction() : array
- Remove items user restriction on language field
- replaceParsedSiteConfiguration() : string
- resolveItemsProcessorFunction() : array
- Resolve "itemsProcFunc" of elements.
Methods
addIconFromAltIcons()
Add alternative icon using "altIcons" TSconfig
public
addIconFromAltIcons(array $result, array $items, string $table, string $fieldName) : array
Parameters
- $result : array
- $items : array
- $table : string
- $fieldName : string
Return values
arrayinjectConnectionPool()
public
injectConnectionPool(ConnectionPool $connectionPool) : void
Parameters
- $connectionPool : ConnectionPool
injectEnvPlaceholderProcessor()
public
injectEnvPlaceholderProcessor(EnvPlaceholderProcessor $envPlaceholderProcessor) : void
Parameters
- $envPlaceholderProcessor : EnvPlaceholderProcessor
injectFileRepository()
public
injectFileRepository(FileRepository $fileRepository) : void
Parameters
- $fileRepository : FileRepository
injectFlashMessageService()
public
injectFlashMessageService(FlashMessageService $flashMessageService) : void
Parameters
- $flashMessageService : FlashMessageService
injectIconFactory()
public
injectIconFactory(IconFactory $iconFactory) : void
Parameters
- $iconFactory : IconFactory
injectItemProcessingService()
public
injectItemProcessingService(ItemProcessingService $itemProcessingService) : void
Parameters
- $itemProcessingService : ItemProcessingService
sanitizeItemArray()
Sanitize incoming item array
public
sanitizeItemArray(mixed $itemArray, string $tableName, string $fieldName) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $itemArray : mixed
- $tableName : string
- $fieldName : string
Tags
Return values
arraytranslateLabels()
Translate the item labels
public
translateLabels(array $result, array $itemArray, string $table, string $fieldName) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $itemArray : array
-
Items
- $table : string
- $fieldName : string
Return values
arrayaddItemsFromFolder()
TCA config "fileFolder" evaluation. Add them to $items
protected
addItemsFromFolder(array $result, string $fieldName, array $items) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Tags
Return values
array —Modified item array
addItemsFromForeignTable()
TCA config "foreign_table" evaluation. Add them to $items
protected
addItemsFromForeignTable(array $result, string $fieldName[, array $items = [] ]) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handled field name
- $items : array = []
-
Incoming items
Tags
Return values
array —Modified item array
addItemsFromPageTsConfig()
Page TSconfig addItems:
protected
addItemsFromPageTsConfig(array $result, string $fieldName, array $items) : array
TCEFORMS.aTable.aField[.types][.aType].addItems.aValue = aLabel, with type specific options merged by pageTsConfig already
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Return values
array —Modified item array
buildForeignTableQueryBuilder()
Build wrapped QueryBuilder to fetch full foreign records. Helper method of {@see self::fetchForeignTableRows()}, do not call otherwise.
protected
buildForeignTableQueryBuilder(array $result, string $localFieldName) : QueryBuilder
Parameters
- $result : array
-
Result array
- $localFieldName : string
-
Current handle field name
Return values
QueryBuilderfetchForeignTableRows()
Fetch one batch with workspace overlays. Leave delete placeholders in the result so callers can use the row count to decide whether to fetch more.
protected
fetchForeignTableRows(array $result, string $fieldName[, int|null $limit = null ][, int $offset = 0 ][, bool $applyPageTsConfig = false ]) : (array|false)[]
Parameters
- $result : array
- $fieldName : string
- $limit : int|null = null
- $offset : int = 0
- $applyPageTsConfig : bool = false
Return values
(array|false)[]getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetLiveUid()
Gets the record uid of the live default record. If already pointing to the live record, the submitted record uid is returned.
protected
getLiveUid(array $result) : int|string
Parameters
- $result : array
-
Result array
Tags
Return values
int|string —If the record is new, uid will be a string beginning with "NEW". Otherwise an int.
hasSelectableTreeItems()
Check tree-field visibility without changing its raw TCA items or building labels, icons and full item rows. Shared by selectTree and category fields.
protected
hasSelectableTreeItems(array $result, string $fieldName) : bool
Parameters
- $result : array
- $fieldName : string
Return values
boolparseSiteConfiguration()
Parse ###SITE:### placeholders in the input string and return the replacements array for later use in $this->replaceParsedSiteConfiguration().
protected
parseSiteConfiguration(SiteInterface|null $site, string $input) : array
IMPORTANT: If the values are used within raw SQL statements (e.g. foreign_table_where), consider using $this->quoteParsedSiteConfiguration() before replacement.
Parameters
- $site : SiteInterface|null
- $input : string
Return values
arrayparseStartingPointsFromMarkers()
A field's [treeConfig][startingPoints] may contain markers, resolve them.
protected
parseStartingPointsFromMarkers(array $result, string $fieldName, array $fieldConfig) : array
###CURRENT_PID### - is the current page id (pid of the record). ###SITEROOT### - is the uid of the site root page within the current rootline. ###PAGE_TSCONFIG_ID### - a value you can set from page TSconfig dynamically. ###PAGE_TSCONFIG_IDLIST### - a value you can set from page TSconfig dynamically.
Markers that can not be resolved are dropped from the list.
Parameters
- $result : array
- $fieldName : string
- $fieldConfig : array
Return values
arrayparseStartingPointsFromSiteConfiguration()
A field's [treeConfig][startingPoints] can be set via site config, parse possibly set values
protected
parseStartingPointsFromSiteConfiguration(array $result, array $fieldConfig) : array
Parameters
- $result : array
- $fieldConfig : array
Return values
arrayprocessDatabaseFieldValue()
Convert the current database values into an array
protected
processDatabaseFieldValue(array $row, string $fieldName) : array
Parameters
- $row : array
-
database row
- $fieldName : string
-
fieldname to process
Return values
arrayprocessForeignTableClause()
Replace markers in a where clause from TCA foreign_table_where
protected
processForeignTableClause(array $result, string $foreignTableName, string $localFieldName) : array
###REC_FIELD_[field name]### ###THIS_UID### - is current element uid (zero if new). ###CURRENT_PID### - is the current page id (pid of the record). ###SITEROOT### ###PAGE_TSCONFIG_ID### - a value you can set from page TSconfig dynamically. ###PAGE_TSCONFIG_IDLIST### - a value you can set from page TSconfig dynamically. ###PAGE_TSCONFIG_STR### - a value you can set from page TSconfig dynamically.
Parameters
- $result : array
-
Result array
- $foreignTableName : string
-
Name of foreign table
- $localFieldName : string
-
Current handle field name
Return values
array —Query parts with keys WHERE, ORDERBY, GROUPBY, LIMIT
processSelectFieldValue()
Validate and sanitize database row values of the select field with the given name.
protected
processSelectFieldValue(array $result, string $fieldName, array $staticValues) : array
Creates an array out of databaseRow[selectField] values.
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
The current result array.
- $fieldName : string
-
Name of the current select field.
- $staticValues : array
-
Array with statically defined items, item value is used as array key.
Return values
arrayquoteParsedSiteConfiguration()
protected
quoteParsedSiteConfiguration(Connection $connection, array $parsedSiteConfiguration) : array
Parameters
- $connection : Connection
- $parsedSiteConfiguration : array
Return values
arrayremoveItemsByDoktypeUserRestriction()
Remove items if doktype is handled for non admin users
protected
removeItemsByDoktypeUserRestriction(array $result, string $fieldName, array $items) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Return values
array —Modified item array
removeItemsByKeepItemsPageTsConfig()
Remove items using "keepItems" pageTsConfig
protected
removeItemsByKeepItemsPageTsConfig(array $result, string $fieldName, array $items) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Return values
array —Modified item array
removeItemsByRemoveItemsPageTsConfig()
Remove items using "removeItems" pageTsConfig
protected
removeItemsByRemoveItemsPageTsConfig(array $result, string $fieldName, array $items) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Return values
array —Modified item array
removeItemsByUserAuthMode()
Remove items by user restriction on authMode items
protected
removeItemsByUserAuthMode(array $result, string $fieldName, array $items) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Return values
array —Modified item array
removeItemsByUserLanguageFieldRestriction()
Remove items user restriction on language field
protected
removeItemsByUserLanguageFieldRestriction(array $result, string $fieldName, array $items) : array
Used by TcaSelectItems and TcaSelectTreeItems data providers
Parameters
- $result : array
-
Result array
- $fieldName : string
-
Current handle field name
- $items : array
-
Incoming items
Return values
array —Modified item array
replaceParsedSiteConfiguration()
protected
replaceParsedSiteConfiguration(string $input, array $parsedSiteConfiguration) : string
Parameters
- $input : string
- $parsedSiteConfiguration : array
Return values
stringresolveItemsProcessorFunction()
Resolve "itemsProcFunc" of elements.
protected
resolveItemsProcessorFunction(array $result, string $fieldName, array $items) : array
Parameters
- $result : array
-
Main result array
- $fieldName : string
-
Field name to handle item list for
- $items : array
-
Existing items array
Return values
array —New list of item elements