ExtensionUtility

class \TYPO3\CMS\Extbase\Utility\ExtensionUtility

Utilities to manage plugins and modules of an extension. Also useful to auto-generate the autoloader registry file ext_autoload.php.

Table of Contents

Constants

PLUGIN_TYPE_CONTENT_ELEMENT  : string = 'CType'

Methods

configurePlugin()  : void
Add auto-generated TypoScript to configure the Extbase Dispatcher.
registerControllerActions()  : void
registerPlugin()  : string
Register an Extbase PlugIn into backend's list of plugins FOR USE IN Configuration/TCA/Overrides/tt_content.php
resolveControllerAliasFromControllerClassName()  : string
actionCommaListToArray()  : array<string, string[]>
checkExtensionNameFormat()  : mixed
Check a given extension name for validity.
checkPluginNameFormat()  : mixed
Check a given plugin name for validity.

Constants

PLUGIN_TYPE_CONTENT_ELEMENT

public string PLUGIN_TYPE_CONTENT_ELEMENT = 'CType'

Methods

configurePlugin()

Add auto-generated TypoScript to configure the Extbase Dispatcher.

public static configurePlugin(string $extensionName, string $pluginName, array $controllerActions[, array $nonCacheableControllerActions = [] ][, string|null $pluginType = null ]) : 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. Including the plugin code after "defaultContentRendering" adds the necessary TypoScript for calling the appropriate controller and action of your plugin. FOR USE IN ext_localconf.php FILES Usage: 2

Parameters

$extensionName : string

The extension name (in UpperCamelCase) or the extension key (in lower_underscore)

$pluginName : string

must be a unique id for your plugin in UpperCamelCase (the string length of the extension key added to the length of the plugin name should be less than 32!)

$controllerActions : array

is an array of allowed combinations of controller and action stored in an array (controller class name as key and an array of action names as value, the first controller and its first action is chosen as default)

$nonCacheableControllerActions : array = []

is an optional array of controller class names and action names which should not be cached (array as defined in $controllerActions)

$pluginType : string|null = null

must be omitted or set to \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT - actually unused in the method, for b/w compatibility only

Tags

throws
InvalidArgumentException

registerControllerActions()

public static registerControllerActions(string $extensionName, string $pluginName, array<string, string[]> $controllerActions, array<string, string[]> $nonCacheableControllerActions) : void

Parameters

$extensionName : string
$pluginName : string
$controllerActions : array<string, string[]>
$nonCacheableControllerActions : array<string, string[]>

registerPlugin()

Register an Extbase PlugIn into backend's list of plugins FOR USE IN Configuration/TCA/Overrides/tt_content.php

public static registerPlugin(string $extensionName, string $pluginName, string $pluginTitle[, string|null $pluginIcon = null ][, string $group = 'plugins' ][, string $pluginDescription = '' ][, string $flexForm = '' ]) : string

Parameters

$extensionName : string

The extension name (in UpperCamelCase) or the extension key (in lower_underscore)

$pluginName : string

must be a unique id for your plugin in UpperCamelCase (the string length of the extension key added to the length of the plugin name should be less than 32!)

$pluginTitle : string

is a speaking title of the plugin that will be displayed in the drop down menu in the backend

$pluginIcon : string|null = null

is an icon identifier or file path prepended with "EXT:", that will be displayed in the drop down menu in the backend (optional)

$group : string = 'plugins'

add this plugin to a plugin group, should be something like "news" or the like, "plugins" as regular

$pluginDescription : string = ''

additional description

$flexForm : string = ''

The flex form (data structure) to be used for the plugin. Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly.

Tags

throws
InvalidArgumentException

Return values

string

resolveControllerAliasFromControllerClassName()

public static resolveControllerAliasFromControllerClassName(string $controllerClassName) : string

Parameters

$controllerClassName : string

Return values

string

actionCommaListToArray()

protected static actionCommaListToArray(array<string, string|string[]> $controllerActions) : array<string, string[]>

Parameters

$controllerActions : array<string, string|string[]>

Return values

array<string, string[]>

checkExtensionNameFormat()

Check a given extension name for validity.

protected static checkExtensionNameFormat(string $extensionName) : mixed

Parameters

$extensionName : string

The name of the extension

Tags

throws
InvalidArgumentException

checkPluginNameFormat()

Check a given plugin name for validity.

protected static checkPluginNameFormat(string $pluginName) : mixed

Parameters

$pluginName : string

The name of the plugin

Tags

throws
InvalidArgumentException
On this page