CategoryRegistry implements SingletonInterface
Class to register category configurations.
since v11, will be removed in v12
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Properties
- $addedCategoryTabs : array<string|int, mixed>
- $extensions : array<string|int, mixed>
- $registry : array<string|int, mixed>
- $template : string
Methods
- __construct() : mixed
- Creates this object.
- add() : bool
- Adds a new category configuration to this registry.
- addCategoryDatabaseSchema() : void
- A event listener to inject the required category database fields to the tables definition string
- applyTcaForPreRegisteredTables() : mixed
- Apply TCA to all registered tables
- getCategorizedTables() : array<string|int, mixed>
- Gets all categorized tables
- getCategoryFieldsForTable() : mixed
- Returns a list of category fields for a given table for populating selector "category_field" in tt_content table (called as itemsProcFunc).
- getDatabaseTableDefinition() : string
- Generates table definitions for registered tables by an extension.
- getDatabaseTableDefinitions() : string
- Generates tables definitions for all registered tables.
- getExtensionKeys() : array<string|int, mixed>
- Gets all extension keys that registered a category configuration.
- getInstance() : CategoryRegistry
- Returns a class instance
- getTcaFieldConfiguration() : array<string|int, mixed>
- Get the config array for given table and field.
- isRegistered() : bool
- Tells whether a table has a category configuration in the registry.
- addCategoryTab() : string
- Creates the 'fieldList' string for $fieldName which includes a categories tab.
- addTcaColumn() : mixed
- Add a new TCA Column
- addToAllTCAtypes() : mixed
- Add a new field into the TCA types -> showitem
- applyTcaForTableAndField() : mixed
- Applies the additions directly to the TCA
- getLanguageService() : LanguageService
- registerDefaultCategorizedTables() : mixed
- Add default categorized tables to the registry
- remove() : mixed
- Removes the given field in the given table from the registry if it is found.
Properties
$addedCategoryTabs
protected
array<string|int, mixed>
$addedCategoryTabs
= []
$extensions
protected
array<string|int, mixed>
$extensions
= []
$registry
protected
array<string|int, mixed>
$registry
= []
$template
protected
string
$template
= ''
Methods
__construct()
Creates this object.
public
__construct() : mixed
add()
Adds a new category configuration to this registry.
public
add(string $extensionKey, string $tableName[, string $fieldName = 'categories' ][, array<string|int, mixed> $options = [] ][, bool $override = false ]) : bool
TCA changes are directly applied
Parameters
- $extensionKey : string
-
Extension key to be used
- $tableName : string
-
Name of the table to be registered
- $fieldName : string = 'categories'
-
Name of the field to be registered
- $options : array<string|int, mixed> = []
-
Additional configuration options
- fieldList: field configuration to be added to showitems
- typesList: list of types that shall visualize the categories field
- position: insert position of the categories field
- label: backend label of the categories field
- fieldConfiguration: TCA field config array to override defaults
- $override : bool = false
-
If TRUE, any category configuration for the same table / field is removed before the new configuration is added
Tags
Return values
booladdCategoryDatabaseSchema()
A event listener to inject the required category database fields to the tables definition string
public
addCategoryDatabaseSchema(AlterTableDefinitionStatementsEvent $event) : void
Parameters
- $event : AlterTableDefinitionStatementsEvent
applyTcaForPreRegisteredTables()
Apply TCA to all registered tables
public
applyTcaForPreRegisteredTables() : mixed
getCategorizedTables()
Gets all categorized tables
public
getCategorizedTables() : array<string|int, mixed>
Return values
array<string|int, mixed>getCategoryFieldsForTable()
Returns a list of category fields for a given table for populating selector "category_field" in tt_content table (called as itemsProcFunc).
public
getCategoryFieldsForTable(array<string|int, mixed> &$configuration) : mixed
Parameters
- $configuration : array<string|int, mixed>
-
Current field configuration
Tags
getDatabaseTableDefinition()
Generates table definitions for registered tables by an extension.
public
getDatabaseTableDefinition(string $extensionKey) : string
Parameters
- $extensionKey : string
-
Extension key to have the database definitions created for
Return values
stringgetDatabaseTableDefinitions()
Generates tables definitions for all registered tables.
public
getDatabaseTableDefinitions() : string
Return values
stringgetExtensionKeys()
Gets all extension keys that registered a category configuration.
public
getExtensionKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>getInstance()
Returns a class instance
public
static getInstance() : CategoryRegistry
Return values
CategoryRegistrygetTcaFieldConfiguration()
Get the config array for given table and field.
public
static getTcaFieldConfiguration(string $tableName[, string $fieldName = 'categories' ][, array<string|int, mixed> $fieldConfigurationOverride = [] ]) : array<string|int, mixed>
This method does NOT take care of adding sql fields, adding the field to TCA types nor does it set the MM_oppositeUsage in the sys_category TCA. This has to be taken care of manually!
Parameters
- $tableName : string
-
The table name
- $fieldName : string = 'categories'
-
The field name (default categories)
- $fieldConfigurationOverride : array<string|int, mixed> = []
-
Changes to the default configuration
Return values
array<string|int, mixed>isRegistered()
Tells whether a table has a category configuration in the registry.
public
isRegistered(string $tableName[, string $fieldName = 'categories' ]) : bool
Parameters
- $tableName : string
-
Name of the table to be looked up
- $fieldName : string = 'categories'
-
Name of the field to be looked up
Return values
booladdCategoryTab()
Creates the 'fieldList' string for $fieldName which includes a categories tab.
protected
addCategoryTab(string $tableName, string $fieldName) : string
But only one categories tab is added per table.
Parameters
- $tableName : string
- $fieldName : string
Return values
stringaddTcaColumn()
Add a new TCA Column
protected
addTcaColumn(string $tableName, string $fieldName, array<string|int, mixed> $options) : mixed
Parameters
- $tableName : string
-
Name of the table to be categorized
- $fieldName : string
-
Name of the field to be used to store categories
- $options : array<string|int, mixed>
-
Additional configuration options
- fieldConfiguration: TCA field config array to override defaults
- label: backend label of the categories field
- interface: boolean if the category should be included in the "interface" section of the TCA table
- l10n_mode
- l10n_display
addToAllTCAtypes()
Add a new field into the TCA types -> showitem
protected
addToAllTCAtypes(string $tableName, string $fieldName, array<string|int, mixed> $options) : mixed
Parameters
- $tableName : string
-
Name of the table to be categorized
- $fieldName : string
-
Name of the field to be used to store categories
- $options : array<string|int, mixed>
-
Additional configuration options
- fieldList: field configuration to be added to showitems
- typesList: list of types that shall visualize the categories field
- position: insert position of the categories field
applyTcaForTableAndField()
Applies the additions directly to the TCA
protected
applyTcaForTableAndField(string $tableName, string $fieldName) : mixed
Parameters
- $tableName : string
- $fieldName : string
getLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServiceregisterDefaultCategorizedTables()
Add default categorized tables to the registry
protected
registerDefaultCategorizedTables() : mixed
remove()
Removes the given field in the given table from the registry if it is found.
protected
remove(string $tableName, string $fieldName) : mixed
Parameters
- $tableName : string
-
The name of the table for which the registration should be removed.
- $fieldName : string
-
The name of the field for which the registration should be removed.