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  = 'CType'
PLUGIN_TYPE_PLUGIN  = 'list_type'

Methods

configurePlugin()  : mixed
Add auto-generated TypoScript to configure the Extbase Dispatcher.
getControllerClassName()  : string
Returns the object name of the controller defined by the extension name and controller name
registerModule()  : mixed
Registers an Extbase module (main or sub) to the backend interface.
registerPlugin()  : mixed
Register an Extbase PlugIn into backend's list of plugins FOR USE IN Configuration/TCA/Overrides/tt_content.php
registerTypeConverter()  : mixed
Register a type converter by class name.
resolveControllerAliasFromControllerClassName()  : string
resolveVendorFromExtensionAndControllerClassName()  : string
checkExtensionNameFormat()  : mixed
Check a given extension name for validity.
checkPluginNameFormat()  : mixed
Check a given plugin name for validity.
checkVendorNameFormat()  : mixed
Check a given vendor name for CGL compliance.

Constants

PLUGIN_TYPE_CONTENT_ELEMENT

public mixed PLUGIN_TYPE_CONTENT_ELEMENT = 'CType'

PLUGIN_TYPE_PLUGIN

public mixed PLUGIN_TYPE_PLUGIN = 'list_type'

Methods

configurePlugin()

Add auto-generated TypoScript to configure the Extbase Dispatcher.

public static configurePlugin(string $extensionName, string $pluginName, array<string|int, mixed> $controllerActions[, array<string|int, mixed> $nonCacheableControllerActions = [] ][, string $pluginType = self::PLUGIN_TYPE_PLUGIN ]) : mixed

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<string|int, mixed>

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

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

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

$pluginType : string = self::PLUGIN_TYPE_PLUGIN

either \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_PLUGIN (default) or \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT

Tags
throws
InvalidArgumentException

getControllerClassName()

Returns the object name of the controller defined by the extension name and controller name

public static getControllerClassName(string $vendor, string $extensionKey, string $subPackageKey, string $controllerAlias) : string
Parameters
$vendor : string
$extensionKey : string
$subPackageKey : string
$controllerAlias : string
Tags
throws
NoSuchControllerException

if the controller does not exist

Return values
string

The controller's Object Name

registerModule()

Registers an Extbase module (main or sub) to the backend interface.

public static registerModule(string $extensionName[, string $mainModuleName = '' ][, string $subModuleName = '' ][, string $position = '' ][, array<string|int, mixed> $controllerActions = [] ][, array<string|int, mixed> $moduleConfiguration = [] ]) : mixed

FOR USE IN ext_tables.php FILES

Parameters
$extensionName : string

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

$mainModuleName : string = ''

The main module key. So $main would be an index in the $TBE_MODULES array and $sub could be an element in the lists there. If $subModuleName is not set a blank $extensionName module is created

$subModuleName : string = ''

The submodule key.

$position : string = ''

This can be used to set the position of the $sub module within the list of existing submodules for the main module. $position has this syntax: [cmd]:[submodule-key]. cmd can be "after", "before" or "top" (or blank which is default). If "after"/"before" then submodule will be inserted after/before the existing submodule with [submodule-key] if found. If not found, the bottom of list. If "top" the module is inserted in the top of the submodule list.

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

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

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

The configuration options of the module (icon, locallang.xlf file)

Tags
throws
InvalidArgumentException

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 $pluginIcon = null ][, string $group = 'default' ]) : mixed
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

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 = 'default'

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

Tags
throws
InvalidArgumentException

registerTypeConverter()

Register a type converter by class name.

public static registerTypeConverter(string $typeConverterClassName) : mixed
Parameters
$typeConverterClassName : string

resolveControllerAliasFromControllerClassName()

public static resolveControllerAliasFromControllerClassName(string $controllerClassName) : string
Parameters
$controllerClassName : string
Return values
string

resolveVendorFromExtensionAndControllerClassName()

public static resolveVendorFromExtensionAndControllerClassName(string $extensionName, string $controllerClassName) : string
Parameters
$extensionName : string
$controllerClassName : string
Return values
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

checkVendorNameFormat()

Check a given vendor name for CGL compliance.

protected static checkVendorNameFormat(string $vendorName, string $extensionName) : mixed

Log a deprecation message if it is not.

Parameters
$vendorName : string

The vendor name to check

$extensionName : string

The extension name that is affected


        
On this page

Search results