TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Extbase\Utility\ExtensionUtility Class Reference

Static Public Member Functions

static configurePlugin ($extensionName, $pluginName, array $controllerActions, array $nonCacheableControllerActions=[], $pluginType=self::PLUGIN_TYPE_PLUGIN)
 
static registerPlugin ($extensionName, $pluginName, $pluginTitle, $pluginIconPathAndFilename=null)
 
static configureModule ($moduleSignature, $modulePath)
 
static registerModule ($extensionName, $mainModuleName='', $subModuleName='', $position='', array $controllerActions=[], array $moduleConfiguration=[])
 
static registerTypeConverter ($typeConverterClassName)
 

Public Attributes

const PLUGIN_TYPE_PLUGIN = 'list_type'
 
const PLUGIN_TYPE_CONTENT_ELEMENT = 'CType'
 

Static Protected Member Functions

static checkVendorNameFormat ($vendorName, $extensionName)
 
static checkExtensionNameFormat ($extensionName)
 
static checkPluginNameFormat ($pluginName)
 

Detailed Description

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

Definition at line 21 of file ExtensionUtility.php.

Member Function Documentation

◆ checkExtensionNameFormat()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::checkExtensionNameFormat (   $extensionName)
staticprotected

Check a given extension name for validity.

Parameters
string$extensionNameThe name of the extension
Exceptions

Definition at line 266 of file ExtensionUtility.php.

◆ checkPluginNameFormat()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::checkPluginNameFormat (   $pluginName)
staticprotected

Check a given plugin name for validity.

Parameters
string$pluginNameThe name of the plugin
Exceptions

Definition at line 280 of file ExtensionUtility.php.

◆ checkVendorNameFormat()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::checkVendorNameFormat (   $vendorName,
  $extensionName 
)
staticprotected

Check a given vendor name for CGL compliance. Log a deprecation message if it is not.

Parameters
string$vendorNameThe vendor name to check
string$extensionNameThe extension name that is affected
Returns
void

Definition at line 252 of file ExtensionUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\deprecationLog().

◆ configureModule()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::configureModule (   $moduleSignature,
  $modulePath 
)
static

This method is called from ::checkMod and it replaces old conf.php.

Parameters
string$moduleSignatureThe module name
string$modulePathAbsolute path to module (not used by Extbase currently)
Returns
array Configuration of the module
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, please use the according method in ::configureModule

Definition at line 154 of file ExtensionUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ configurePlugin()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin (   $extensionName,
  $pluginName,
array  $controllerActions,
array  $nonCacheableControllerActions = [],
  $pluginType = self::PLUGIN_TYPE_PLUGIN 
)
static

Add auto-generated TypoScript to configure the Extbase Dispatcher.

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. This means, it will also work for the extension "css_styled_content" FOR USE IN ext_localconf.php FILES Usage: 2

Parameters
string$extensionNameThe extension name (in UpperCamelCase) or the extension key (in lower_underscore)
string$pluginNamemust 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!)
array$controllerActionsis 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)
array$nonCacheableControllerActionsis an optional array of controller name and action names which should not be cached (array as defined in $controllerActions)
string$pluginTypeeither ::PLUGIN_TYPE_PLUGIN (default) or ::PLUGIN_TYPE_CONTENT_ELEMENT
Exceptions

Definition at line 45 of file ExtensionUtility.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addTypoScript(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginCreatesCorrectDefaultTypoScriptSetup(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginRespectsDefaultActionAsANonCacheableAction(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginRespectsNonDefaultActionAsANonCacheableAction(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginThrowsExceptionIfExtensionNameIsEmpty(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginThrowsExceptionIfPluginNameIsEmpty(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginWorksForASingleControllerAction(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginWorksForMinimalisticSetup(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginWorksForMultipleControllerActionsWithCacheableActionAsDefault(), and TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\configurePluginWorksForMultipleControllerActionsWithNonCacheableActionAsDefault().

◆ registerModule()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule (   $extensionName,
  $mainModuleName = '',
  $subModuleName = '',
  $position = '',
array  $controllerActions = [],
array  $moduleConfiguration = [] 
)
static

Registers an Extbase module (main or sub) to the backend interface. FOR USE IN ext_tables.php FILES

Parameters
string$extensionNameThe extension name (in UpperCamelCase) or the extension key (in lower_underscore)
string$mainModuleNameThe 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
string$subModuleNameThe submodule key.
string$positionThis 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.
array$controllerActionsis 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)
array$moduleConfigurationThe configuration options of the module (icon, locallang.xlf file)
Exceptions

Definition at line 173 of file ExtensionUtility.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addModule(), TYPO3\CMS\Core\Utility\GeneralUtility\camelCaseToLowerCaseUnderscored(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extRelPath(), TYPO3\CMS\Core\Utility\ArrayUtility\mergeRecursiveWithOverrule(), TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode(), and TYPO3\CMS\Core\Utility\GeneralUtility\underscoredToUpperCamelCase().

◆ registerPlugin()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin (   $extensionName,
  $pluginName,
  $pluginTitle,
  $pluginIconPathAndFilename = null 
)
static

Register an Extbase PlugIn into backend's list of plugins FOR USE IN ext_tables.php FILES

Parameters
string$extensionNameThe extension name (in UpperCamelCase) or the extension key (in lower_underscore)
string$pluginNamemust 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!)
string$pluginTitleis a speaking title of the plugin that will be displayed in the drop down menu in the backend
string$pluginIconPathAndFilenameis a path to an icon file (relative to TYPO3_mainDir), that will be displayed in the drop down menu in the backend (optional)
Exceptions

Definition at line 117 of file ExtensionUtility.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addPlugin(), and TYPO3\CMS\Core\Utility\GeneralUtility\camelCaseToLowerCaseUnderscored().

Referenced by TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\registerPluginTriggersAddPluginWhichSetsPluginIconPathIfIconPathIsGiven(), TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\registerPluginTriggersAddPluginWhichSetsPluginIconPathIfUsingUnderscoredExtensionNameAndIconPathNotGiven(), and TYPO3\CMS\Extbase\Tests\Unit\Utility\ExtensionUtilityTest\registerPluginTriggersAddPluginWhichSetsPluginIconPathIfUsingUpperCameCasedExtensionNameAndIconPathNotGiven().

◆ registerTypeConverter()

static TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter (   $typeConverterClassName)
static

Register a type converter by class name.

Parameters
string$typeConverterClassName
Returns
void

Definition at line 236 of file ExtensionUtility.php.

References $GLOBALS.

Member Data Documentation

◆ PLUGIN_TYPE_CONTENT_ELEMENT

const TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT = 'CType'

Definition at line 24 of file ExtensionUtility.php.

◆ PLUGIN_TYPE_PLUGIN

const TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_PLUGIN = 'list_type'

Definition at line 23 of file ExtensionUtility.php.