‪TYPO3CMS  10.4
TYPO3\CMS\Core\Category\CategoryRegistry Class Reference
Inheritance diagram for TYPO3\CMS\Core\Category\CategoryRegistry:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct ()
 
bool add ($extensionKey, $tableName, $fieldName='categories', array $options=[], $override=false)
 
array getExtensionKeys ()
 
array getCategorizedTables ()
 
 getCategoryFieldsForTable (array &$configuration)
 
bool isRegistered ($tableName, $fieldName='categories')
 
string getDatabaseTableDefinitions ()
 
string getDatabaseTableDefinition ($extensionKey)
 
 applyTcaForPreRegisteredTables ()
 
 addCategoryDatabaseSchema (AlterTableDefinitionStatementsEvent $event)
 

Static Public Member Functions

static CategoryRegistry getInstance ()
 
static array getTcaFieldConfiguration ($tableName, $fieldName='categories', array $fieldConfigurationOverride=[])
 

Protected Member Functions

 applyTcaForTableAndField ($tableName, $fieldName)
 
 registerDefaultCategorizedTables ()
 
 addToAllTCAtypes ($tableName, $fieldName, array $options)
 
string addCategoryTab ($tableName, $fieldName)
 
 addTcaColumn ($tableName, $fieldName, array $options)
 
LanguageService getLanguageService ()
 
 remove ($tableName, $fieldName)
 

Protected Attributes

array $registry = array( )
 
array $extensions = array( )
 
array $addedCategoryTabs = array( )
 
string $template = ''
 

Detailed Description

Class to register category configurations.

Definition at line 28 of file CategoryRegistry.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Category\CategoryRegistry::__construct ( )

Creates this object.

Definition at line 60 of file CategoryRegistry.php.

Member Function Documentation

◆ add()

bool TYPO3\CMS\Core\Category\CategoryRegistry::add (   $extensionKey,
  $tableName,
  $fieldName = 'categories',
array  $options = [],
  $override = false 
)

Adds a new category configuration to this registry. TCA changes are directly applied

Parameters
string$extensionKey‪Extension key to be used
string$tableName‪Name of the table to be registered
string$fieldName‪Name of the field to be registered
array$options‪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
bool$override‪If TRUE, any category configuration for the same table / field is removed before the new configuration is added
Returns
‪bool
Exceptions

Definition at line 85 of file CategoryRegistry.php.

References $GLOBALS, TYPO3\CMS\Core\Category\CategoryRegistry\applyTcaForTableAndField(), and TYPO3\CMS\Core\Category\CategoryRegistry\isRegistered().

Referenced by TYPO3\CMS\Core\Utility\ExtensionManagementUtility\makeCategorizable(), and TYPO3\CMS\Core\Category\CategoryRegistry\registerDefaultCategorizedTables().

◆ addCategoryDatabaseSchema()

TYPO3\CMS\Core\Category\CategoryRegistry::addCategoryDatabaseSchema ( AlterTableDefinitionStatementsEvent  $event)

A event listener to inject the required category database fields to the tables definition string

Parameters
AlterTableDefinitionStatementsEvent$event

Definition at line 427 of file CategoryRegistry.php.

References TYPO3\CMS\Core\Database\Event\AlterTableDefinitionStatementsEvent\addSqlData(), TYPO3\CMS\Core\Category\CategoryRegistry\getDatabaseTableDefinitions(), and TYPO3\CMS\Core\Category\CategoryRegistry\registerDefaultCategorizedTables().

◆ addCategoryTab()

string TYPO3\CMS\Core\Category\CategoryRegistry::addCategoryTab (   $tableName,
  $fieldName 
)
protected

Creates the 'fieldList' string for $fieldName which includes a categories tab. But only one categories tab is added per table.

Parameters
string$tableName
string$fieldName
Returns
‪string

Definition at line 298 of file CategoryRegistry.php.

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\addToAllTCAtypes().

◆ addTcaColumn()

TYPO3\CMS\Core\Category\CategoryRegistry::addTcaColumn (   $tableName,
  $fieldName,
array  $options 
)
protected

Add a new TCA Column

Parameters
string$tableName‪Name of the table to be categorized
string$fieldName‪Name of the field to be used to store categories
array$options‪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

Definition at line 321 of file CategoryRegistry.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addTCAcolumns().

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\applyTcaForTableAndField().

◆ addToAllTCAtypes()

TYPO3\CMS\Core\Category\CategoryRegistry::addToAllTCAtypes (   $tableName,
  $fieldName,
array  $options 
)
protected

Add a new field into the TCA types -> showitem

Parameters
string$tableName‪Name of the table to be categorized
string$fieldName‪Name of the field to be used to store categories
array$options‪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

Definition at line 264 of file CategoryRegistry.php.

References $GLOBALS, TYPO3\CMS\Core\Category\CategoryRegistry\addCategoryTab(), and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addToAllTCAtypes().

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\applyTcaForTableAndField().

◆ applyTcaForPreRegisteredTables()

◆ applyTcaForTableAndField()

TYPO3\CMS\Core\Category\CategoryRegistry::applyTcaForTableAndField (   $tableName,
  $fieldName 
)
protected

◆ getCategorizedTables()

array TYPO3\CMS\Core\Category\CategoryRegistry::getCategorizedTables ( )

Gets all categorized tables

Returns
‪array

Definition at line 129 of file CategoryRegistry.php.

◆ getCategoryFieldsForTable()

TYPO3\CMS\Core\Category\CategoryRegistry::getCategoryFieldsForTable ( array &  $configuration)

Returns a list of category fields for a given table for populating selector "category_field" in tt_content table (called as itemsProcFunc).

Parameters
array$configuration‪Current field configuration
Exceptions

Definition at line 142 of file CategoryRegistry.php.

References $fields, $GLOBALS, TYPO3\CMS\Core\Category\CategoryRegistry\getLanguageService(), and TYPO3\CMS\Core\Localization\LanguageService\sL().

◆ getDatabaseTableDefinition()

string TYPO3\CMS\Core\Category\CategoryRegistry::getDatabaseTableDefinition (   $extensionKey)

Generates table definitions for registered tables by an extension.

Parameters
string$extensionKey‪Extension key to have the database definitions created for
Returns
‪string

Definition at line 195 of file CategoryRegistry.php.

References $fields.

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\getDatabaseTableDefinitions().

◆ getDatabaseTableDefinitions()

string TYPO3\CMS\Core\Category\CategoryRegistry::getDatabaseTableDefinitions ( )

◆ getExtensionKeys()

array TYPO3\CMS\Core\Category\CategoryRegistry::getExtensionKeys ( )

Gets all extension keys that registered a category configuration.

Returns
‪array

Definition at line 118 of file CategoryRegistry.php.

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\getDatabaseTableDefinitions().

◆ getInstance()

◆ getLanguageService()

LanguageService TYPO3\CMS\Core\Category\CategoryRegistry::getLanguageService ( )
protected
Returns
‪LanguageService

Definition at line 436 of file CategoryRegistry.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\getCategoryFieldsForTable().

◆ getTcaFieldConfiguration()

static array TYPO3\CMS\Core\Category\CategoryRegistry::getTcaFieldConfiguration (   $tableName,
  $fieldName = 'categories',
array  $fieldConfigurationOverride = [] 
)
static

Get the config array for given table and field. 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
string$tableName‪The table name
string$fieldName‪The field name (default categories)
array$fieldConfigurationOverride‪Changes to the default configuration
Returns
‪array

Definition at line 383 of file CategoryRegistry.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule().

◆ isRegistered()

bool TYPO3\CMS\Core\Category\CategoryRegistry::isRegistered (   $tableName,
  $fieldName = 'categories' 
)

Tells whether a table has a category configuration in the registry.

Parameters
string$tableName‪Name of the table to be looked up
string$fieldName‪Name of the field to be looked up
Returns
‪bool

Definition at line 168 of file CategoryRegistry.php.

Referenced by TYPO3\CMS\Core\Category\CategoryRegistry\add(), TYPO3\CMS\Core\Category\CategoryRegistry\registerDefaultCategorizedTables(), and TYPO3\CMS\Core\Category\CategoryRegistry\remove().

◆ registerDefaultCategorizedTables()

◆ remove()

TYPO3\CMS\Core\Category\CategoryRegistry::remove (   $tableName,
  $fieldName 
)
protected

Removes the given field in the given table from the registry if it is found.

Parameters
string$tableName‪The name of the table for which the registration should be removed.
string$fieldName‪The name of the field for which the registration should be removed.

Definition at line 447 of file CategoryRegistry.php.

References TYPO3\CMS\Core\Category\CategoryRegistry\isRegistered().

Member Data Documentation

◆ $addedCategoryTabs

array TYPO3\CMS\Core\Category\CategoryRegistry::$addedCategoryTabs = array( )
protected

Definition at line 40 of file CategoryRegistry.php.

◆ $extensions

array TYPO3\CMS\Core\Category\CategoryRegistry::$extensions = array( )
protected

Definition at line 36 of file CategoryRegistry.php.

◆ $registry

array TYPO3\CMS\Core\Category\CategoryRegistry::$registry = array( )
protected

Definition at line 32 of file CategoryRegistry.php.

◆ $template

string TYPO3\CMS\Core\Category\CategoryRegistry::$template = ''
protected

Definition at line 44 of file CategoryRegistry.php.