TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Category\CategoryRegistry Class Reference
Inheritance diagram for TYPO3\CMS\Core\Category\CategoryRegistry:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 __construct ()
 
 add ($extensionKey, $tableName, $fieldName='categories', array $options=[], $override=false)
 
 getExtensionKeys ()
 
 getCategorizedTables ()
 
 getCategoryFieldsForTable (array &$configuration)
 
 isRegistered ($tableName, $fieldName='categories')
 
 getDatabaseTableDefinitions ()
 
 getDatabaseTableDefinition ($extensionKey)
 
 applyTcaForPreRegisteredTables ()
 
 addCategoryDatabaseSchemaToTablesDefinition (array $sqlString)
 
 addExtensionCategoryDatabaseSchemaToTablesDefinition (array $sqlString, $extensionKey)
 

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $registry = []
 
 $extensions = []
 
 $addedCategoryTabs = []
 
 $template = ''
 

Detailed Description

Class to register category configurations.

Definition at line 26 of file CategoryRegistry.php.

Constructor & Destructor Documentation

◆ __construct()

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

Creates this object.

Definition at line 61 of file CategoryRegistry.php.

Member Function Documentation

◆ add()

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$extensionKeyExtension key to be used
string$tableNameName of the table to be registered
string$fieldNameName of the field to be registered
array$optionsAdditional 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$overrideIf 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(), TYPO3\CMS\Core\Category\CategoryRegistry\isRegistered(), and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\loadNewTcaColumnsConfigFiles().

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

◆ addCategoryDatabaseSchemaToTablesDefinition()

TYPO3\CMS\Core\Category\CategoryRegistry::addCategoryDatabaseSchemaToTablesDefinition ( array  $sqlString)

A slot method to inject the required category database fields to the tables definition string

Parameters
array$sqlString
Returns
array

Definition at line 447 of file CategoryRegistry.php.

References TYPO3\CMS\Core\Category\CategoryRegistry\getDatabaseTableDefinitions(), and TYPO3\CMS\Core\Category\CategoryRegistry\registerDefaultCategorizedTables().

◆ addCategoryTab()

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 309 of file CategoryRegistry.php.

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

◆ addExtensionCategoryDatabaseSchemaToTablesDefinition()

TYPO3\CMS\Core\Category\CategoryRegistry::addExtensionCategoryDatabaseSchemaToTablesDefinition ( array  $sqlString,
  $extensionKey 
)

A slot method to inject the required category database fields of an extension to the tables definition string

Parameters
array$sqlString
string$extensionKey
Returns
array

Definition at line 462 of file CategoryRegistry.php.

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

◆ addTcaColumn()

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

Add a new TCA Column

Parameters
string$tableNameName of the table to be categorized
string$fieldNameName of the field to be used to store categories
array$optionsAdditional 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
Returns
void

Definition at line 333 of file CategoryRegistry.php.

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

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$tableNameName of the table to be categorized
string$fieldNameName of the field to be used to store categories
array$optionsAdditional 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
Returns
void

Definition at line 275 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()

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

◆ applyTcaForTableAndField()

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

◆ getCategorizedTables()

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

Gets all categorized tables

Returns
array

Definition at line 132 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$configurationCurrent field configuration
Exceptions

Definition at line 145 of file CategoryRegistry.php.

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

◆ getDatabaseTableDefinition()

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

Generates table definitions for registered tables by an extension.

Parameters
string$extensionKeyExtension key to have the database definitions created for
Returns
string

Definition at line 202 of file CategoryRegistry.php.

References $sql.

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

◆ getDatabaseTableDefinitions()

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

◆ getExtensionKeys()

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

Gets all extension keys that registered a category configuration.

Returns
array

Definition at line 122 of file CategoryRegistry.php.

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

◆ getInstance()

◆ getLanguageService()

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

Definition at line 471 of file CategoryRegistry.php.

References $GLOBALS.

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

◆ getTcaFieldConfiguration()

static 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$tableNameThe table name
string$fieldNameThe field name (default categories)
array$fieldConfigurationOverrideChanges to the default configuration
Returns
array

Definition at line 402 of file CategoryRegistry.php.

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

◆ isRegistered()

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

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

Parameters
string$tableNameName of the table to be looked up
string$fieldNameName of the field to be looked up
Returns
bool

Definition at line 177 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$tableNameThe name of the table for which the registration should be removed.
string$fieldNameThe name of the field for which the registration should be removed.

Definition at line 482 of file CategoryRegistry.php.

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

Member Data Documentation

◆ $addedCategoryTabs

TYPO3\CMS\Core\Category\CategoryRegistry::$addedCategoryTabs = []
protected

Definition at line 41 of file CategoryRegistry.php.

◆ $extensions

TYPO3\CMS\Core\Category\CategoryRegistry::$extensions = []
protected

Definition at line 36 of file CategoryRegistry.php.

◆ $registry

TYPO3\CMS\Core\Category\CategoryRegistry::$registry = []
protected

Definition at line 31 of file CategoryRegistry.php.

◆ $template

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

Definition at line 46 of file CategoryRegistry.php.