CategoryRegistry implements SingletonInterface

Class to register category configurations.

Deprecated

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 = []

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

Internal
Tags
throws
InvalidArgumentException
throws
RuntimeException
Return values
bool

applyTcaForPreRegisteredTables()

Apply TCA to all registered tables

public applyTcaForPreRegisteredTables() : mixed
Internal

getCategorizedTables()

Gets all categorized tables

public getCategorizedTables() : array<string|int, mixed>
Internal
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

Internal
Tags
throws
UnexpectedValueException

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

Internal
Return values
string

getDatabaseTableDefinitions()

Generates tables definitions for all registered tables.

public getDatabaseTableDefinitions() : string
Internal
Return values
string

getExtensionKeys()

Gets all extension keys that registered a category configuration.

public getExtensionKeys() : array<string|int, mixed>
Internal
Return values
array<string|int, mixed>

getTcaFieldConfiguration()

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

Internal
Return values
bool

addCategoryTab()

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
string

addTcaColumn()

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

registerDefaultCategorizedTables()

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.


        
On this page

Search results