Skip to content

Commit

Permalink
[TASK] Remove unnecessary call_user_func wrapping in TCA override exa…
Browse files Browse the repository at this point in the history
…mple

References /issues/4756
Releases: main,12.4
  • Loading branch information
dogawaf committed Sep 16, 2024
1 parent 8e93b6e commit 5c8a1ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The following call needs to be added to the file
.. literalinclude:: _AddingYourOwnContentElements/_tt_content.php
:caption: EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
:linenos:
:emphasize-lines: 12
:emphasize-lines: 10

Now the new content element is available in the CType selector and the
"New Content Element" wizard.
Expand Down Expand Up @@ -114,7 +114,7 @@ The new content element wizard
.. literalinclude:: _AddingYourOwnContentElements/_tt_content.php
:caption: EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
:linenos:
:emphasize-lines: 17,18,19
:emphasize-lines: 15,16,17

The values in the array highlighted in the code example above are used for the
display in the :guilabel:`New Content Element` wizard.
Expand Down Expand Up @@ -146,13 +146,13 @@ the file :file:`Configuration/TCA/Overrides/tt_content.php`:
.. literalinclude:: _AddingYourOwnContentElements/_tt_content.php
:caption: EXT:my_extension/Configuration/TCA/Overrides/tt_content.php
:linenos:
:emphasize-lines: 28,29
:emphasize-lines: 26,27

In line 28 a custom :ref:`palette <t3tca:palettes>` with the header and related
In line 27 a custom :ref:`palette <t3tca:palettes>` with the header and related
fields is displayed. This palette and its fields are defined in
:t3src:`typo3/sysext/frontend/Configuration/TCA/tt_content.php`.

In line 29 a predefined field, `bodytext` is added to be displayed in the
In line 28 a predefined field, `bodytext` is added to be displayed in the
form of the new content element type.

.. index:: Content element; Frontend rendering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,25 @@

defined('TYPO3') or die();

call_user_func(function () {
$key = 'myextension_basiccontent';

$key = 'myextension_basiccontent';
// Adds the content element to the "Type" dropdown
ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'label' => 'Example - basic content',
'value' => $key,
'group' => 'default',
],
'textmedia',
'after',
);

// Adds the content element to the "Type" dropdown
ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'label' => 'Example - basic content',
'value' => $key,
'group' => 'default',
],
'textmedia',
'after',
);

// Configure the default backend fields for the content element
$GLOBALS['TCA']['tt_content']['types'][$key] = [
'showitem' => '
// Configure the default backend fields for the content element
$GLOBALS['TCA']['tt_content']['types'][$key] = [
'showitem' => '
--palette--;;headers,
bodytext,
',
];
});
];

0 comments on commit 5c8a1ef

Please sign in to comment.