ExtensionManagementUtility

Extension Management functions

This class is never instantiated, rather the methods inside is called as functions like \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('my_extension');

Table of Contents

Properties

$cacheManager  : CacheManager|null
$eventDispatcher  : EventDispatcherInterface
$extTablesWasReadFromCacheOnce  : bool
TRUE, if ext_tables file was read from cache for this script run.
$packageManager  : PackageManager

Methods

addCoreNavigationComponent()  : mixed
Registers a core navigation component
addFieldsToAllPalettesOfField()  : void
Adds new fields to all palettes that is defined after an existing field.
addFieldsToPalette()  : void
Adds new fields to a palette.
addFieldsToUserSettings()  : void
Adds a list of new fields to the TYPO3 USER SETTINGS configuration "showitem" list, the array with the new fields itself needs to be added additionally to show up in the user setup, like $GLOBALS['TYPO3_USER_SETTINGS']['columns'] += $tempColumns
addLLrefForTCAdescr()  : mixed
Adds a reference to a locallang file with $GLOBALS['TCA_DESCR'] labels FOR USE IN ext_tables.php FILES eg. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('pages', 'EXT:core/Resources/Private/Language/locallang_csh_pages.xlf'); for the pages table or \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_web_layout', 'EXT:frontend/Resources/Private/Language/locallang_csh_weblayout.xlf'); for the Web > Page module.
addModule()  : mixed
To allow extension authors to support multiple versions, this method is kept until TYPO3 v13, but is no longer used nor evaluated from TYPO3 v12.0. To add modules, place the configuration in your extensions' Configuration/Backend/Modules.php file.
addNavigationComponent()  : mixed
Registers a navigation component e.g. page tree
addPageTSConfig()  : void
Adds $content to the default page TSconfig as set in $GLOBALS['TYPO3_CONF_VARS'][BE]['defaultPageTSconfig'] Prefixed with a [GLOBAL] line FOR USE IN ext_localconf.php FILE
addPiFlexFormValue()  : void
Adds an entry to the "ds" array of the tt_content field "pi_flexform".
addPItoST43()  : void
Add PlugIn to the default template rendering (previously called "Static Template #43")
addPlugin()  : void
Adds an entry to the list of plugins in content elements of type "Insert plugin" Takes the $itemArray (label, value[,icon]) and adds to the items-array of $GLOBALS['TCA'][tt_content] elements with CType "listtype" (or another field if $type points to another fieldname) If the value (array pos. 1) is already found in that items-array, the entry is substituted, otherwise the input array is added to the bottom.
addService()  : void
Adds a service to the global services array
addStaticFile()  : void
Call this method to add an entry in the static template list found in sys_templates FOR USE IN Configuration/TCA/Overrides/sys_template.php Use in ext_tables.php may break the frontend.
addTCAcolumns()  : void
Adding fields to an existing table definition in $GLOBALS['TCA'] Adds an array with $GLOBALS['TCA'] column-configuration to the $GLOBALS['TCA']-entry for that table.
addTcaSelectItem()  : void
Add an item to a select field item list.
addTcaSelectItemGroup()  : void
Adds an item group to a TCA select field, allows to add a group so addTcaSelectItem() can add a groupId with a label and its position within other groups.
addToAllTCAtypes()  : void
Makes fields visible in the TCEforms, adding them to the end of (all) "types"-configurations
addToInsertRecords()  : void
Adds the $table tablename to the list of tables allowed to be includes by content element type "Insert records" By using $content_table and $content_field you can also use the function for other tables.
addTypoScript()  : void
Adds $content to the default TypoScript code for either setup or constants as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_*'] (Basically this function can do the same as addTypoScriptSetup and addTypoScriptConstants - just with a little more hazzle, but also with some more options!) FOR USE IN ext_localconf.php FILES Note: As of TYPO3 CMS 6.2, static template #43 (content: default) was replaced with "defaultContentRendering" which makes it possible that a first extension like fluid_styled_content registers a "contentRendering" template (= a template that defines default content rendering TypoScript) by adding itself to $TYPO3_CONF_VARS[FE][contentRenderingTemplates][] = 'myext/Configuration/TypoScript'.
addTypoScriptConstants()  : void
Adds $content to the default TypoScript constants code as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_constants'] NOT prefixed with a [GLOBAL] line, other calls MUST properly close their conditions! FOR USE IN ext_localconf.php FILES
addTypoScriptSetup()  : void
Adds $content to the default TypoScript setup code as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_setup'].
addUserTSConfig()  : void
Adds $content to the default user TSconfig as set in $GLOBALS['TYPO3_CONF_VARS'][BE]['defaultUserTSconfig'] Prefixed with a [GLOBAL] line FOR USE IN ext_localconf.php FILE
allowTableOnStandardPages()  : void
Add tablename to default list of allowed tables on pages (in $PAGES_TYPES) Will add the $table to the list of tables allowed by default on pages as setup by $PAGES_TYPES['default']['allowedTables'] FOR USE IN ext_tables.php FILES
buildBaseTcaFromSingleFiles()  : void
Find all Configuration/TCA/* files of extensions and create base TCA from it.
createBaseTcaCacheFile()  : void
Cache base $GLOBALS['TCA'] to cache file to require the whole thing in one file for next access instead of cycling through all extensions again.
createExtLocalconfCacheEntry()  : void
Create cache entry for concatenated ext_localconf.php files
createExtTablesCacheEntry()  : void
Create concatenated ext_tables.php cache file
deactivateService()  : void
Deactivate a service
extPath()  : string
Returns the absolute path to the extension with extension key $key.
findService()  : array<string|int, mixed>|false
Find the available service with highest priority
findServiceByKey()  : array<string|int, mixed>
Find a specific service identified by its key Note that this completely bypasses the notions of priority and quality
getCN()  : string
Returns the correct class name prefix for the extension key $key
getExtensionIcon()  : string
Find extension icon
getExtensionVersion()  : string
Retrieves the version of an installed extension.
getFileFieldTCAConfig()  : array<string|int, mixed>
Gets the TCA configuration for a field handling (FAL) files.
getLoadedExtensionListArray()  : array<string|int, mixed>
Gets an array of loaded extension keys
insertModuleFunction()  : mixed
Adds a "Function menu module" ('third level module') to an existing function menu of some other backend module.
isLoaded()  : bool
Returns TRUE if the extension with extension key $key is loaded.
isServiceAvailable()  : bool
Check if a given service is available, based on the executable files it depends on
loadBaseTca()  : void
Wrapper for buildBaseTcaFromSingleFiles handling caching.
loadExtension()  : void
Loads given extension
loadExtLocalconf()  : void
Execute all ext_localconf.php files of loaded extensions.
loadExtTables()  : void
Execute all ext_tables.php files of loaded extensions.
registerPageTSConfigFile()  : void
Call this method to add an entry in the page TSconfig list found in pages FOR USE in Configuration/TCA/Overrides/pages.php
resolvePackagePath()  : string
Temporary helper method to resolve paths with the PackageManager.
setEventDispatcher()  : void
Sets the event dispatcher to be available.
setPackageManager()  : void
Sets the package manager for all that backwards compatibility stuff, so it doesn't have to be fetched through the bootstrap.
unloadExtension()  : void
Unloads given extension
dispatchTcaIsBeingBuiltEvent()  : void
Triggers an event for manipulating the final TCA
executePositionedStringInsertion()  : string
Inserts as list of data into an existing list.
getBaseTcaCacheIdentifier()  : string
Cache identifier of base TCA cache entry.
getCacheManager()  : CacheManager
Returns the Cache manager
getExtLocalconfCacheIdentifier()  : string
Cache identifier of concatenated ext_localconf file
getExtTablesCacheIdentifier()  : string
Cache identifier for concatenated ext_tables.php files
loadSingleExtLocalconfFiles()  : void
Execute ext_localconf.php files from extensions
loadSingleExtTablesFiles()  : void
Load ext_tables.php as single files
removeDuplicatesForInsertion()  : string
Compares an existing list of items and a list of items to be inserted and returns a duplicate-free variant of that insertion list.

Properties

$eventDispatcher

protected static EventDispatcherInterface $eventDispatcher

$extTablesWasReadFromCacheOnce

TRUE, if ext_tables file was read from cache for this script run.

protected static bool $extTablesWasReadFromCacheOnce = false

The frontend tends to do that multiple times, but the caching framework does not allow this (via a require_once call). This variable is used to track the access to the cache file to read the single ext_tables.php if it was already read from cache

Tags
todo

See if we can get rid of the 'load multiple times' scenario in fe

Methods

addCoreNavigationComponent()

Registers a core navigation component

public static addCoreNavigationComponent(string $module, string $componentId) : mixed
Deprecated

no longer in use. Will be removed in TYPO3 v13.0.

Parameters
$module : string
$componentId : string

addFieldsToAllPalettesOfField()

Adds new fields to all palettes that is defined after an existing field.

public static addFieldsToAllPalettesOfField(string $table, string $field, string $addFields[, string $insertionPosition = '' ]) : void

If the field does not have a following palette yet, it's created automatically and gets called "generatedFor-$field". FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

See unit tests for more examples and edge cases.

Example:

'aTable' => array( 'types' => array( 'aType' => array( 'showitem' => 'aField, --palette--;;aPalette', ), ), 'palettes' => array( 'aPalette' => array( 'showitem' => 'fieldB, fieldC', ), ), ),

Calling addFieldsToAllPalettesOfField('aTable', 'aField', 'newA', 'before: fieldC') results in:

'aTable' => array( 'types' => array( 'aType' => array( 'showitem' => 'aField, --palette--;;aPalette', ), ), 'palettes' => array( 'aPalette' => array( 'showitem' => 'fieldB, newA, fieldC', ), ), ),

Parameters
$table : string

Name of the table

$field : string

Name of the field that has the palette to be extended

$addFields : string

Comma-separated list of fields to be added to the palette

$insertionPosition : string = ''

Insert fields before (default) or after one

addFieldsToPalette()

Adds new fields to a palette.

public static addFieldsToPalette(string $table, string $palette, string $addFields[, string $insertionPosition = '' ]) : void

If the palette does not exist yet, it's created automatically. FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

Parameters
$table : string

Name of the table

$palette : string

Name of the palette to be extended

$addFields : string

Comma-separated list of fields to be added to the palette

$insertionPosition : string = ''

Insert fields before (default) or after one

addFieldsToUserSettings()

Adds a list of new fields to the TYPO3 USER SETTINGS configuration "showitem" list, the array with the new fields itself needs to be added additionally to show up in the user setup, like $GLOBALS['TYPO3_USER_SETTINGS']['columns'] += $tempColumns

public static addFieldsToUserSettings(string $addFields[, string $insertionPosition = '' ]) : void
Parameters
$addFields : string

List of fields to be added to the user settings

$insertionPosition : string = ''

Insert fields before (default) or after one

addLLrefForTCAdescr()

Adds a reference to a locallang file with $GLOBALS['TCA_DESCR'] labels FOR USE IN ext_tables.php FILES eg. \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('pages', 'EXT:core/Resources/Private/Language/locallang_csh_pages.xlf'); for the pages table or \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_web_layout', 'EXT:frontend/Resources/Private/Language/locallang_csh_weblayout.xlf'); for the Web > Page module.

public static addLLrefForTCAdescr(string $key, string $file) : mixed
Deprecated

The functionality has been removed in v12. The method will be removed in TYPO3 v13.

Parameters
$key : string

Description key. Typically a database table (like "pages") but for applications can be other strings, but prefixed with "MOD")

$file : string

File reference to locallang file, eg. "EXT:core/Resources/Private/Language/locallang_csh_pages.xlf"

addModule()

To allow extension authors to support multiple versions, this method is kept until TYPO3 v13, but is no longer used nor evaluated from TYPO3 v12.0. To add modules, place the configuration in your extensions' Configuration/Backend/Modules.php file.

public static addModule(mixed $main[, mixed $sub = '' ][, mixed $position = '' ][, mixed $path = null ][, mixed $moduleConfiguration = [] ]) : mixed
Deprecated

The functionality has been removed in v12. The method will be removed in TYPO3 v13.

The method deliberately does not throw a deprecation warning in order to keep the noise of deprecation warnings small.

Parameters
$main : mixed
$sub : mixed = ''
$position : mixed = ''
$path : mixed = null
$moduleConfiguration : mixed = []

addNavigationComponent()

Registers a navigation component e.g. page tree

public static addNavigationComponent(string $module, string $componentId, string $extensionKey) : mixed
Deprecated

no longer in use. Will be removed in TYPO3 v13.0.

Parameters
$module : string
$componentId : string

componentId is also a RequireJS module name e.g. 'TYPO3/CMS/MyExt/MyNavComponent'

$extensionKey : string
Tags
throws
RuntimeException

addPageTSConfig()

Adds $content to the default page TSconfig as set in $GLOBALS['TYPO3_CONF_VARS'][BE]['defaultPageTSconfig'] Prefixed with a [GLOBAL] line FOR USE IN ext_localconf.php FILE

public static addPageTSConfig(string $content) : void
Parameters
$content : string

Page TSconfig content

addPiFlexFormValue()

Adds an entry to the "ds" array of the tt_content field "pi_flexform".

public static addPiFlexFormValue(string $piKeyToMatch, string $value[, string $CTypeToMatch = 'list' ]) : void

This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin or content element. FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

Parameters
$piKeyToMatch : string

Plugin key as used in the list_type field. Use the asterisk * to match all list_type values.

$value : string

Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly.

$CTypeToMatch : string = 'list'

Value of tt_content.CType (Content Type) to match. The default is "list" which corresponds to the "Insert Plugin" content element. Use the asterisk * to match all CType values.

Tags
see
addPlugin()

addPItoST43()

Add PlugIn to the default template rendering (previously called "Static Template #43")

public static addPItoST43(string $key[, string $_ = '' ][, string $suffix = '' ][, string $type = 'list_type' ][, bool $cacheable = false ]) : void

When adding a frontend plugin you will have to add both an entry to the TCA definition of tt_content table AND to the TypoScript template which must initiate the rendering.

The naming of #43 has historic reason and is rooted inside code which is now put into a TER extension called "statictemplates". Since the static template with uid 43 is the "content.default" and practically always used for rendering the content elements it's very useful to have this function automatically adding the necessary TypoScript for calling your plugin. The logic is now generalized and called "defaultContentRendering", see addTypoScript() as well.

$type determines the type of frontend plugin:

  • list_type (default) - the good old "Insert plugin" entry
  • CType - a new content element type
  • includeLib - just includes the library for manual use somewhere in TypoScript. (Remember that your $type definition should correspond to the column/items array in $GLOBALS['TCA'][tt_content] where you added the selector item for the element! See addPlugin() function) FOR USE IN ext_localconf.php FILES
Parameters
$key : string

The extension key

$_ : string = ''

unused since TYPO3 CMS 8

$suffix : string = ''

Is used as a suffix of the class name (e.g. "_pi1")

$type : string = 'list_type'

See description above

$cacheable : bool = false

If $cached is set as USER content object (cObject) is created - otherwise a USER_INT object is created.

addPlugin()

Adds an entry to the list of plugins in content elements of type "Insert plugin" Takes the $itemArray (label, value[,icon]) and adds to the items-array of $GLOBALS['TCA'][tt_content] elements with CType "listtype" (or another field if $type points to another fieldname) If the value (array pos. 1) is already found in that items-array, the entry is substituted, otherwise the input array is added to the bottom.

public static addPlugin(array<string|int, mixed>|SelectItem $itemArray[, string $type = 'list_type' ][, string|null $extensionKey = null ]) : void

Use this function to add a frontend plugin to this list of plugin-types - or more generally use this function to add an entry to any selectorbox/radio-button set in the FormEngine

FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

Parameters
$itemArray : array<string|int, mixed>|SelectItem

Numerical or assoc array: [0 or 'label'] => Plugin label, [1 or 'value'] => Plugin identifier / plugin key, ideally prefixed with an extension-specific name (e.g. "events2_list"), [2 or 'icon'] => Icon identifier or path to plugin icon, [3 or 'group'] => an optional "group" ID, falls back to "default"

$type : string = 'list_type'
$extensionKey : string|null = null

The extension key

Tags
throws
RuntimeException

addService()

Adds a service to the global services array

public static addService(string $extKey, string $serviceType, string $serviceKey, array<string|int, mixed> $info) : void
Parameters
$extKey : string

Extension key

$serviceType : string

Service type, must not be prefixed "tx_" or "Tx_"

$serviceKey : string

Service key, must be prefixed "tx_", "Tx_" or "user_"

$info : array<string|int, mixed>

Service description array

addStaticFile()

Call this method to add an entry in the static template list found in sys_templates FOR USE IN Configuration/TCA/Overrides/sys_template.php Use in ext_tables.php may break the frontend.

public static addStaticFile(string $extKey, string $path, string $title) : void
Parameters
$extKey : string

Is of course the extension key

$path : string

Is the path where the template files "constants.typoscript", "setup.typoscript", and "include_static_file.txt" are found (relative to extPath, eg. "Configuration/TypoScript/Static/"). The file "include_static_file.txt", allows including other static templates defined in files, from your static template, and thus corresponds to the field 'include_static_file' in the sys_template table. The syntax for this is a comma separated list of static templates to include, example: EXT:fluid_styled_content/Configuration/TypoScript/,EXT:other_extension/Configuration/TypoScript/

$title : string

Is the title in the selector box.

Tags
throws
InvalidArgumentException
see
addTypoScript()

addTCAcolumns()

Adding fields to an existing table definition in $GLOBALS['TCA'] Adds an array with $GLOBALS['TCA'] column-configuration to the $GLOBALS['TCA']-entry for that table.

public static addTCAcolumns(string $table, array<string|int, mixed> $columnArray) : void

This function adds the configuration needed for rendering of the field in TCEFORMS - but it does NOT add the field names to the types lists! So to have the fields displayed you must also call fx. addToAllTCAtypes or manually add the fields to the types list. FOR USE IN files in Configuration/TCA/Overrides/*.php . Use in ext_tables.php FILES may break the frontend.

Parameters
$table : string

The table name of a table already present in $GLOBALS['TCA'] with a columns section

$columnArray : array<string|int, mixed>

The array with the additional columns (typical some fields an extension wants to add)

addTcaSelectItem()

Add an item to a select field item list.

public static addTcaSelectItem(string $table, string $field, array<string|int, mixed> $item[, string $relativeToField = '' ][, string $relativePosition = '' ]) : void

Warning: Do not use this method for radio or check types, especially not with $relativeToField and $relativePosition parameters. This would shift existing database data 'off by one'. FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

As an example, this can be used to add an item to tt_content CType select drop-down after the existing 'mailform' field with these parameters:

  • $table = 'tt_content'
  • $field = 'CType'
  • $item = array( 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.10', 'login', 'i/imagename.gif', ),
  • $relativeToField = mailform
  • $relativePosition = after

$item has an optional fourth parameter for the groupId (string), to attach the new item to. The groupname is defined when a group is added with addTcaSelectItemGroup

Parameters
$table : string

Name of TCA table

$field : string

Name of TCA field

$item : array<string|int, mixed>

New item to add

$relativeToField : string = ''

Add item relative to existing field

$relativePosition : string = ''

Valid keywords: 'before', 'after'

Tags
throws
InvalidArgumentException

If given parameters are not of correct

throws
RuntimeException

If reference to related position fields can not

addTcaSelectItemGroup()

Adds an item group to a TCA select field, allows to add a group so addTcaSelectItem() can add a groupId with a label and its position within other groups.

public static addTcaSelectItemGroup(string $table, string $field, string $groupId, string $groupLabel[, string|null $position = 'bottom' ]) : void
Parameters
$table : string

the table name in TCA - e.g. tt_content

$field : string

the field name in TCA - e.g. CType

$groupId : string

the unique identifier for a group, where all items from addTcaSelectItem() with a group ID are connected

$groupLabel : string

the label e.g. LLL:EXT:my_extension/Resources/Private/Language/locallang_tca.xlf:group.mygroupId

$position : string|null = 'bottom'

e.g. "before:special", "after:default" (where the part after the colon is an existing groupId) or "top" or "bottom"

addToAllTCAtypes()

Makes fields visible in the TCEforms, adding them to the end of (all) "types"-configurations

public static addToAllTCAtypes(string $table, string $newFieldsString[, string $typeList = '' ][, string $position = '' ]) : void

Adds a string $string (comma separated list of field names) to all ["types"][xxx]["showitem"] entries for table $table (unless limited by $typeList) This is needed to have new fields shown automatically in the TCEFORMS of a record from $table. Typically this function is called after having added new columns (database fields) with the addTCAcolumns function FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

Parameters
$table : string

Table name

$newFieldsString : string

Field list to add.

$typeList : string = ''

Comma-separated list of specific types to add the field list to. (If empty, all type entries are affected)

$position : string = ''

Insert fields before (default) or after one, or replace a field

addToInsertRecords()

Adds the $table tablename to the list of tables allowed to be includes by content element type "Insert records" By using $content_table and $content_field you can also use the function for other tables.

public static addToInsertRecords(string $table[, string $content_table = 'tt_content' ][, string $content_field = 'records' ]) : void

FOR USE IN files in Configuration/TCA/Overrides/*.php Use in ext_tables.php FILES may break the frontend.

Parameters
$table : string

Table name to allow for "insert record

$content_table : string = 'tt_content'

Table name TO WHICH the $table name is applied. See $content_field as well.

$content_field : string = 'records'

Field name in the database $content_table in which $table is allowed to be added as a reference ("Insert Record")

addTypoScript()

Adds $content to the default TypoScript code for either setup or constants as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_*'] (Basically this function can do the same as addTypoScriptSetup and addTypoScriptConstants - just with a little more hazzle, but also with some more options!) FOR USE IN ext_localconf.php FILES Note: As of TYPO3 CMS 6.2, static template #43 (content: default) was replaced with "defaultContentRendering" which makes it possible that a first extension like fluid_styled_content registers a "contentRendering" template (= a template that defines default content rendering TypoScript) by adding itself to $TYPO3_CONF_VARS[FE][contentRenderingTemplates][] = 'myext/Configuration/TypoScript'.

public static addTypoScript(string $key, string $type, string $content[, int|string $afterStaticUid = 0 ]) : void

An extension calling addTypoScript('myext', 'setup', $typoScript, 'defaultContentRendering') will add its TypoScript directly after; For now, "43" and "defaultContentRendering" can be used, but "defaultContentRendering" is more descriptive and should be used in the future.

Parameters
$key : string

Is the extension key (informative only).

$type : string

Is either "setup" or "constants" and obviously determines which kind of TypoScript code we are adding.

$content : string

Is the TS content, will be prefixed with a [GLOBAL] line and a comment-header.

$afterStaticUid : int|string = 0

string pointing to the "key" of a static_file template ([reduced extension_key]/[local path]). The points is that the TypoScript you add is included only IF that static template is included (and in that case, right after). So effectively the TypoScript you set can specifically overrule settings from those static templates.

Tags
throws
InvalidArgumentException

addTypoScriptConstants()

Adds $content to the default TypoScript constants code as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_constants'] NOT prefixed with a [GLOBAL] line, other calls MUST properly close their conditions! FOR USE IN ext_localconf.php FILES

public static addTypoScriptConstants(string $content) : void
Parameters
$content : string

TypoScript Constants string

addTypoScriptSetup()

Adds $content to the default TypoScript setup code as set in $GLOBALS['TYPO3_CONF_VARS'][FE]['defaultTypoScript_setup'].

public static addTypoScriptSetup(string $content) : void

NOT prefixed with a [GLOBAL] line, other calls MUST properly close their conditions! FOR USE IN ext_localconf.php FILES

Parameters
$content : string

TypoScript Setup string

addUserTSConfig()

Adds $content to the default user TSconfig as set in $GLOBALS['TYPO3_CONF_VARS'][BE]['defaultUserTSconfig'] Prefixed with a [GLOBAL] line FOR USE IN ext_localconf.php FILE

public static addUserTSConfig(string $content) : void
Parameters
$content : string

User TSconfig content

allowTableOnStandardPages()

Add tablename to default list of allowed tables on pages (in $PAGES_TYPES) Will add the $table to the list of tables allowed by default on pages as setup by $PAGES_TYPES['default']['allowedTables'] FOR USE IN ext_tables.php FILES

public static allowTableOnStandardPages(string $table) : void
Deprecated

will be removed in TYPO3 v13.0. Use $GLOBALS['TCA'][$table]['ctrl']['security']['ignorePageTypeRestriction'] instead.

Parameters
$table : string

Table name

buildBaseTcaFromSingleFiles()

Find all Configuration/TCA/* files of extensions and create base TCA from it.

public static buildBaseTcaFromSingleFiles() : void

The filename must be the table name in $GLOBALS['TCA'], and the content of the file should return an array with content of a specific table.

Internal
Tags
see
Extension

core, extensionmanager and others for examples.

createBaseTcaCacheFile()

Cache base $GLOBALS['TCA'] to cache file to require the whole thing in one file for next access instead of cycling through all extensions again.

public static createBaseTcaCacheFile(FrontendInterface $codeCache) : void
Parameters
$codeCache : FrontendInterface
Internal

createExtLocalconfCacheEntry()

Create cache entry for concatenated ext_localconf.php files

public static createExtLocalconfCacheEntry(FrontendInterface $codeCache) : void
Parameters
$codeCache : FrontendInterface
Internal

deactivateService()

Deactivate a service

public static deactivateService(string $serviceType, string $serviceKey) : void
Parameters
$serviceType : string

Service type

$serviceKey : string

Service key

extPath()

Returns the absolute path to the extension with extension key $key.

public static extPath(string $key[, string $script = '' ]) : string
Parameters
$key : string

Extension key

$script : string = ''

$script is appended to the output if set.

Tags
throws
BadFunctionCallException
Return values
string

findService()

Find the available service with highest priority

public static findService(string $serviceType[, string $serviceSubType = '' ][, array<string|int, mixed> $excludeServiceKeys = [] ]) : array<string|int, mixed>|false
Parameters
$serviceType : string

Service type

$serviceSubType : string = ''

Service sub type

$excludeServiceKeys : array<string|int, mixed> = []

Service keys that should be excluded in the search for a service.

Return values
array<string|int, mixed>|false

Service info array if a service was found, FALSE otherwise

findServiceByKey()

Find a specific service identified by its key Note that this completely bypasses the notions of priority and quality

public static findServiceByKey(string $serviceKey) : array<string|int, mixed>
Parameters
$serviceKey : string

Service key

Tags
throws
Exception
Return values
array<string|int, mixed>

Service info array if a service was found

getCN()

Returns the correct class name prefix for the extension key $key

public static getCN(string $key) : string
Parameters
$key : string

Extension key

Internal
Return values
string

getExtensionIcon()

Find extension icon

public static getExtensionIcon(string $extensionPath[, bool $returnFullPath = false ]) : string
Parameters
$extensionPath : string

Path to extension directory.

$returnFullPath : bool = false

Return full path of file.

Return values
string

getExtensionVersion()

Retrieves the version of an installed extension.

public static getExtensionVersion(string $key) : string

If the extension is not installed, this function returns an empty string.

Parameters
$key : string

The key of the extension to look up; must not be empty.

Tags
throws
InvalidArgumentException
throws
Exception
Return values
string

The extension version as a string in the format "x.y.z",

getFileFieldTCAConfig()

Gets the TCA configuration for a field handling (FAL) files.

public static getFileFieldTCAConfig(string $fieldName[, array<string|int, mixed> $customSettingOverride = [] ][, string $allowedFileExtensions = '' ][, string $disallowedFileExtensions = '' ]) : array<string|int, mixed>
Deprecated

since TYPO3 v12.0. Use the TCA type "file" directly

Parameters
$fieldName : string

Name of the field to be used

$customSettingOverride : array<string|int, mixed> = []

Custom field settings overriding the basics

$allowedFileExtensions : string = ''

Comma-separated list of allowed file extensions (e.g. "jpg,gif,pdf")

$disallowedFileExtensions : string = ''

Comma-separated list of disallowed file extensions (e.g. "doc,docx")

Return values
array<string|int, mixed>

getLoadedExtensionListArray()

Gets an array of loaded extension keys

public static getLoadedExtensionListArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

insertModuleFunction()

Adds a "Function menu module" ('third level module') to an existing function menu of some other backend module.

public static insertModuleFunction(string $modname, string $className, string $_unused, string $title[, string $MM_key = 'function' ][, string $WS = '' ]) : mixed
Deprecated

use the Module Registration API to define calls, will be removed in TYPO3 v13.0.

FOR USE IN ext_tables.php FILES

Parameters
$modname : string

Module name

$className : string

Class name

$_unused : string

not in use anymore

$title : string

Title of module

$MM_key : string = 'function'

Menu array key - default is "function

$WS : string = ''

Workspace conditions. Blank means all workspaces, any other string can be a comma list of "online", "offline" and "custom

isLoaded()

Returns TRUE if the extension with extension key $key is loaded.

public static isLoaded(string $key) : bool
Parameters
$key : string
Return values
bool

isServiceAvailable()

Check if a given service is available, based on the executable files it depends on

public static isServiceAvailable(string $serviceType, string $serviceKey, array<string|int, mixed> $serviceDetails) : bool
Parameters
$serviceType : string

Type of service

$serviceKey : string

Specific key of the service

$serviceDetails : array<string|int, mixed>

Information about the service

Return values
bool

Service availability

loadBaseTca()

Wrapper for buildBaseTcaFromSingleFiles handling caching.

public static loadBaseTca([bool $allowCaching = true ][, FrontendInterface|null $codeCache = null ]) : void

This builds 'base' TCA that is later overloaded by ext_tables.php.

Use a cache file if exists and caching is allowed.

This is an internal method. It is only used during bootstrap and extensions should not use it!

Parameters
$allowCaching : bool = true

Whether or not to load / create concatenated cache file

$codeCache : FrontendInterface|null = null
Internal

loadExtension()

Loads given extension

public static loadExtension(string $extensionKey) : void
Parameters
$extensionKey : string

Extension key to load

Tags
throws
RuntimeException

loadExtLocalconf()

Execute all ext_localconf.php files of loaded extensions.

public static loadExtLocalconf([bool $allowCaching = true ][, FrontendInterface|null $codeCache = null ]) : void

The method implements an optionally used caching mechanism that concatenates all ext_localconf.php files in one file.

This is an internal method. It is only used during bootstrap and extensions should not use it!

Parameters
$allowCaching : bool = true

Whether or not to load / create concatenated cache file

$codeCache : FrontendInterface|null = null
Internal

loadExtTables()

Execute all ext_tables.php files of loaded extensions.

public static loadExtTables([bool $allowCaching = true ][, FrontendInterface|null $codeCache = null ]) : void

The method implements an optionally used caching mechanism that concatenates all ext_tables.php files in one file.

This is an internal method. It is only used during bootstrap and extensions should not use it!

Parameters
$allowCaching : bool = true

Whether to load / create concatenated cache file

$codeCache : FrontendInterface|null = null
Internal

registerPageTSConfigFile()

Call this method to add an entry in the page TSconfig list found in pages FOR USE in Configuration/TCA/Overrides/pages.php

public static registerPageTSConfigFile(string $extKey, string $filePath, string $title) : void
Parameters
$extKey : string

The extension key

$filePath : string

The path where the TSconfig file is located

$title : string

The title in the selector box

Tags
throws
InvalidArgumentException

resolvePackagePath()

Temporary helper method to resolve paths with the PackageManager.

public static resolvePackagePath(string $path) : string

The PackageManager is statically injected to this class already. This method will be removed without substitution in TYPO3 12 once a proper resource API is introduced.

Parameters
$path : string
Internal

This method is only allowed to be called from GeneralUtility::getFileAbsFileName()! DONT'T introduce other usages!

Tags
throws
Exception
Return values
string

setEventDispatcher()

Sets the event dispatcher to be available.

public static setEventDispatcher(EventDispatcherInterface $eventDispatcher) : void
Parameters
$eventDispatcher : EventDispatcherInterface
Internal

only used for tests and the internal TYPO3 Bootstrap process

setPackageManager()

Sets the package manager for all that backwards compatibility stuff, so it doesn't have to be fetched through the bootstrap.

public static setPackageManager(PackageManager $packageManager) : void
Parameters
$packageManager : PackageManager
Internal

unloadExtension()

Unloads given extension

public static unloadExtension(string $extensionKey) : void
Parameters
$extensionKey : string
Tags
throws
RuntimeException

dispatchTcaIsBeingBuiltEvent()

Triggers an event for manipulating the final TCA

protected static dispatchTcaIsBeingBuiltEvent(array<string|int, mixed> $tca) : void
Parameters
$tca : array<string|int, mixed>

executePositionedStringInsertion()

Inserts as list of data into an existing list.

protected static executePositionedStringInsertion(string $list, string $insertionList[, string $insertionPosition = '' ]) : string

The insertion position can be defined accordant before of after existing list items.

Example:

  • list: 'field_a, field_b, field_c'
  • insertionList: 'field_d, field_e'
  • insertionPosition: 'after:field_b' -> 'field_a, field_b, field_d, field_e, field_c'

$insertPosition may contain ; and - characters: after:--palette--;;title

Parameters
$list : string

The list of items to be extended

$insertionList : string

The list of items to inserted

$insertionPosition : string = ''

Insert fields before (default) or after one

Return values
string

The extended list

getBaseTcaCacheIdentifier()

Cache identifier of base TCA cache entry.

protected static getBaseTcaCacheIdentifier() : string
Return values
string

getExtLocalconfCacheIdentifier()

Cache identifier of concatenated ext_localconf file

protected static getExtLocalconfCacheIdentifier() : string
Return values
string

getExtTablesCacheIdentifier()

Cache identifier for concatenated ext_tables.php files

protected static getExtTablesCacheIdentifier() : string
Return values
string

loadSingleExtLocalconfFiles()

Execute ext_localconf.php files from extensions

protected static loadSingleExtLocalconfFiles() : void

loadSingleExtTablesFiles()

Load ext_tables.php as single files

protected static loadSingleExtTablesFiles() : void

removeDuplicatesForInsertion()

Compares an existing list of items and a list of items to be inserted and returns a duplicate-free variant of that insertion list.

protected static removeDuplicatesForInsertion(string $insertionList[, string $list = '' ]) : string

Example:

  • list: 'field_a, field_b, field_c'
  • insertion: 'field_b, field_d, field_c' -> new insertion: 'field_d'

Duplicate values in $insertionList are removed.

Parameters
$insertionList : string

The comma-separated list of items to inserted

$list : string = ''

The comma-separated list of items to be extended

Return values
string

Duplicate-free list of items to be inserted


        
On this page

Search results