Feature #82809
closed\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin should return the registered type
100%
Description
All extensions uses this function and for adding flexform or other extra configuration they 'hardcode' their typename.
To add flexibility the used typename could be returned in the function.
So for example the following is used to register an plugin.
// This creates the myext_display variable available in the core ExtensionUtility::registerPlugin( 'my_ext', 'Display', 'LLL:EXT:my_ext/Resources/Private/Language/locallang_be.xlf:publications.list.title' ); // Setup flex form $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['myext_display'] = 'layout, select_key'; $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['myext_display'] = 'pi_flexform'; ExtensionManagementUtility::addPiFlexFormValue( 'myext_display', 'FILE:EXT:my_ext/Configuration/FlexForm/List.xml' );
While the following would be slightly better and flexible.
$type = ExtensionUtility::registerPlugin( 'my_ext', 'Display', 'LLL:EXT:my_ext/Resources/Private/Language/locallang_be.xlf:publications.list.title' ); if (!empty($type)) { // Setup flex form $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$type] = 'layout, select_key'; $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$type] = 'pi_flexform'; ExtensionManagementUtility::addPiFlexFormValue( $type, 'FILE:EXT:my_ext/Configuration/FlexForm/List.xml' ); }
Updated by Markus Sommer about 6 years ago
you can use $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['my_ext']['plugins']['Display']['pluginType'] to get the type :)
Updated by Benjamin Serfhos about 6 years ago
Markus Sommer wrote:
you can use $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['my_ext']['plugins']['Display']['pluginType'] to get the type :)
I quote from implementation;
Configuration of controllers and actions is now stored in a global registry ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']). But you should never access this directly.
I think my suggestion would be more failproof :x
Updated by Gerrit Code Review over 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Gerrit Code Review over 1 year ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Gerrit Code Review over 1 year ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Gerrit Code Review over 1 year ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Gerrit Code Review over 1 year ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Gerrit Code Review over 1 year ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Gerrit Code Review over 1 year ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74175
Updated by Shehfinaz Kadavil over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 0170fc5a153157a606baae76f1a961dbe5908e1d.