TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
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 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

static checkExtensionNameFormat (   $extensionName)
staticprotected

Check a given extension name for validity.

Parameters
string$extensionNameThe name of the extension
Exceptions
InvalidArgumentException
Returns
void

Definition at line 250 of file ExtensionUtility.php.

static checkPluginNameFormat (   $pluginName)
staticprotected

Check a given plugin name for validity.

Parameters
string$pluginNameThe name of the plugin
Exceptions
InvalidArgumentException
Returns
void

Definition at line 264 of file ExtensionUtility.php.

static 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 236 of file ExtensionUtility.php.

References GeneralUtility\deprecationLog().

static 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
InvalidArgumentException
Returns
void

Definition at line 45 of file ExtensionUtility.php.

References $GLOBALS, ExtensionManagementUtility\addTypoScript(), and GeneralUtility\trimExplode().

Referenced by ExtensionUtilityTest\configurePluginCreatesCorrectDefaultTypoScriptSetup(), ExtensionUtilityTest\configurePluginRespectsDefaultActionAsANonCacheableAction(), ExtensionUtilityTest\configurePluginRespectsNonDefaultActionAsANonCacheableAction(), ExtensionUtilityTest\configurePluginThrowsExceptionIfExtensionNameIsEmpty(), ExtensionUtilityTest\configurePluginThrowsExceptionIfPluginNameIsEmpty(), ExtensionUtilityTest\configurePluginWorksForASingleControllerAction(), ExtensionUtilityTest\configurePluginWorksForMinimalisticSetup(), ExtensionUtilityTest\configurePluginWorksForMultipleControllerActionsWithCacheableActionAsDefault(), and ExtensionUtilityTest\configurePluginWorksForMultipleControllerActionsWithNonCacheableActionAsDefault().

static 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
InvalidArgumentException
Returns
void

Definition at line 158 of file ExtensionUtility.php.

References $GLOBALS, ExtensionManagementUtility\addModule(), ArrayUtility\mergeRecursiveWithOverrule(), GeneralUtility\trimExplode(), and GeneralUtility\underscoredToUpperCamelCase().

static 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
InvalidArgumentException
Returns
void

Definition at line 117 of file ExtensionUtility.php.

References $GLOBALS, ExtensionManagementUtility\addPlugin(), and GeneralUtility\camelCaseToLowerCaseUnderscored().

Referenced by ExtensionUtilityTest\registerPluginTriggersAddPluginWhichSetsPluginIconPathIfIconPathIsGiven(), ExtensionUtilityTest\registerPluginTriggersAddPluginWhichSetsPluginIconPathIfUsingUnderscoredExtensionNameAndIconPathNotGiven(), and ExtensionUtilityTest\registerPluginTriggersAddPluginWhichSetsPluginIconPathIfUsingUpperCameCasedExtensionNameAndIconPathNotGiven().

static registerTypeConverter (   $typeConverterClassName)
static

Register a type converter by class name.

Parameters
string$typeConverterClassName
Returns
void

Definition at line 220 of file ExtensionUtility.php.

References $GLOBALS.

Member Data Documentation

const PLUGIN_TYPE_CONTENT_ELEMENT = 'CType'

Definition at line 24 of file ExtensionUtility.php.

const PLUGIN_TYPE_PLUGIN = 'list_type'

Definition at line 23 of file ExtensionUtility.php.