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

Also available in: Atom PDF