43 public static function configurePlugin($extensionName, $pluginName, array $controllerActions, array $nonCacheableControllerActions = [], $pluginType = self::PLUGIN_TYPE_PLUGIN)
50 $delimiterPosition = strrpos($extensionName,
'.');
51 if ($delimiterPosition !==
false) {
52 $vendorName = str_replace(
'.',
'\\', substr($extensionName, 0, $delimiterPosition));
53 $extensionName = substr($extensionName, $delimiterPosition + 1);
55 if (!empty($vendorName)) {
59 $extensionName = str_replace(
' ',
'', ucwords(str_replace(
'_',
' ', $extensionName)));
61 $pluginSignature = strtolower($extensionName .
'_' . $pluginName);
62 if (!is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'plugins'][$pluginName] ??
false)) {
63 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'plugins'][$pluginName] = [];
65 foreach ($controllerActions as $controllerName => $actionsList) {
66 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'plugins'][$pluginName][
'controllers'][$controllerName] = [
'actions' => \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',', $actionsList)];
67 if (!empty($nonCacheableControllerActions[$controllerName])) {
68 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'plugins'][$pluginName][
'controllers'][$controllerName][
'nonCacheableActions'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',', $nonCacheableControllerActions[$controllerName]);
72 switch ($pluginType) {
74 $pluginContent = trim(
'
75 tt_content.list.20.' . $pluginSignature .
' = USER
76 tt_content.list.20.' . $pluginSignature .
' {
77 userFunc = TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run
78 extensionName = ' . $extensionName .
'
79 pluginName = ' . $pluginName . (
null !== $vendorName ? (
"\n\t" .
'vendorName = ' . $vendorName) :
'') .
'
83 $pluginContent = trim(
'
84 tt_content.' . $pluginSignature .
' =< lib.contentElement
85 tt_content.' . $pluginSignature .
' {
86 templateName = Generic
89 userFunc = TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run
90 extensionName = ' . $extensionName .
'
91 pluginName = ' . $pluginName . (
null !== $vendorName ? (
"\n\t\t" .
'vendorName = ' . $vendorName) :
'') .
'
96 throw new \InvalidArgumentException(
'The pluginType "' . $pluginType .
'" is not suported', 1289858856);
98 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'plugins'][$pluginName][
'pluginType'] = $pluginType;
100 # Setting ' . $extensionName .
' plugin TypoScript
101 ' . $pluginContent,
'defaultContentRendering');
114 public static function registerPlugin($extensionName, $pluginName, $pluginTitle, $pluginIcon =
null)
119 $delimiterPosition = strrpos($extensionName,
'.');
120 if ($delimiterPosition !==
false) {
121 $extensionName = substr($extensionName, $delimiterPosition + 1);
123 $extensionName = str_replace(
' ',
'', ucwords(str_replace(
'_',
' ', $extensionName)));
124 $pluginSignature = strtolower($extensionName) .
'_' . strtolower($pluginName);
128 $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
131 $pluginType =
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'plugins'][$pluginName][
'pluginType'] ??
'list_type';
134 [$pluginTitle, $pluginSignature, $pluginIcon],
152 public static function registerModule($extensionName, $mainModuleName =
'', $subModuleName =
'', $position =
'', array $controllerActions = [], array $moduleConfiguration = [])
158 if (
false !== $delimiterPosition = strrpos($extensionName,
'.')) {
159 $vendorName = str_replace(
'.',
'\\', substr($extensionName, 0, $delimiterPosition));
160 $extensionName = substr($extensionName, $delimiterPosition + 1);
162 if (!empty($vendorName)) {
167 $extensionName = str_replace(
' ',
'', ucwords(str_replace(
'_',
' ', $extensionName)));
168 $defaultModuleConfiguration = [
170 'icon' =>
'EXT:extbase/Resources/Public/Icons/Extension.png',
173 if ($mainModuleName !==
'' && !array_key_exists($mainModuleName,
$GLOBALS[
'TBE_MODULES'])) {
174 $mainModuleName = $extensionName . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($mainModuleName);
176 $mainModuleName = $mainModuleName !==
'' ? $mainModuleName :
'web';
179 if ($mainModuleName ===
'web') {
180 $defaultModuleConfiguration[
'navigationComponentId'] =
'TYPO3/CMS/Backend/PageTree/PageTreeElement';
183 $moduleConfiguration = $defaultModuleConfiguration;
184 $moduleSignature = $mainModuleName;
185 if ($subModuleName !==
'') {
186 $subModuleName = $extensionName . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($subModuleName);
187 $moduleSignature .=
'_' . $subModuleName;
189 $moduleConfiguration[
'name'] = $moduleSignature;
190 if (
null !== $vendorName) {
191 $moduleConfiguration[
'vendorName'] = $vendorName;
193 $moduleConfiguration[
'extensionName'] = $extensionName;
194 $moduleConfiguration[
'routeTarget'] = \TYPO3\CMS\Extbase\Core\Bootstrap::class .
'::handleBackendRequest';
195 if (!is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'modules'][$moduleSignature] ??
false)) {
196 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'modules'][$moduleSignature] = [];
198 foreach ($controllerActions as $controllerName => $actions) {
199 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'extensions'][$extensionName][
'modules'][$moduleSignature][
'controllers'][$controllerName] = [
200 'actions' => \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',', $actions)
213 if (!isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'typeConverters']) ||
214 !is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'typeConverters'])
216 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'typeConverters'] = [];
218 if (!in_array($typeConverterClassName,
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'typeConverters'])) {
219 $GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'extbase'][
'typeConverters'][] = $typeConverterClassName;
232 if (preg_match(
'/^[A-Z]/', $vendorName) !== 1) {
233 trigger_error(
'The vendor name from tx_' . $extensionName .
' must begin with a capital letter.', E_USER_DEPRECATED);
245 if (empty($extensionName)) {
246 throw new \InvalidArgumentException(
'The extension name must not be empty', 1239891990);
258 if (empty($pluginName)) {
259 throw new \InvalidArgumentException(
'The plugin name must not be empty', 1239891988);