Project

General

Profile

Actions

Feature #82809

closed

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin should return the registered type

Added by Benjamin Serfhos over 6 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2017-10-19
Due date:
% Done:

100%

Estimated time:
0.10 h
PHP Version:
Tags:
Complexity:
no-brainer
Sprint Focus:
Remote Sprint

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'
    );
}
Actions #1

Updated by Markus Sommer over 6 years ago

you can use $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['my_ext']['plugins']['Display']['pluginType'] to get the type :)

Actions #2

Updated by Benjamin Serfhos over 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

Actions #3

Updated by Mathias Schreiber about 2 years ago

  • Sprint Focus set to Remote Sprint
Actions #4

Updated by Gerrit Code Review about 2 years 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

Actions #5

Updated by Gerrit Code Review about 2 years 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

Actions #6

Updated by Gerrit Code Review about 2 years 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

Actions #7

Updated by Gerrit Code Review about 2 years 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

Actions #8

Updated by Gerrit Code Review about 2 years 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

Actions #9

Updated by Gerrit Code Review about 2 years 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

Actions #10

Updated by Gerrit Code Review about 2 years 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

Actions #11

Updated by Shehfinaz Kadavil about 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF