Project

General

Profile

Bug #105605

Updated by Lukas Wittmann 6 days ago

Hello TYPO3 Team,  
 I build a new dokType by registering it in my ext_tables.php. I registered it in my TCA/Overrides/pages.php and wanted to add a new palette to my general tab like shown in the following code example: 
 *ext_tables.php:* 
 <pre><code class="php"> 
 // Define a new doktype 
 $customPageDoktype = 198; 
 // Add page type to system 
 $dokTypeRegistry = GeneralUtility::makeInstance(PageDoktypeRegistry::class); 
 $dokTypeRegistry->add( 
     $customPageDoktype, 
     [ 
         'allowedTables' => '*', 
     ], 
 ); 
 </code></pre> 

 
  
 *Configuration/TCA/Overrides/pages.php:* 
 <pre><code class="php"> 
     // Add the new doktype to the page type selector 
     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( 
         'pages', 
         'doktype', 
         [ 
             'label' => 'label', 
             'value' => '198', 
             'group' => 'Journal', 
         ], 
         '198', 
         'after' 
     ); 

     $tempColumns = [ 
         'testField' => [ 
             'label' => 'journal', 
             'config' => [ 
                 'type' => 'input', 
             ] 
         ] 
     ]; 

     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( 
         'pages', 
         $tempColumns 
     ); 

     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette( 
         'pages', 
         'testPalette', 
         'testField' 
     ); 
     // did not work 
     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( 
         'pages', 
         '--palette--;' . $label . ';testPalette', 
         '198', 
         'before:title' 
     ); 
 </code></pre> 

 *Problem:*  
 The addToAllTCAtypes() function didn't work out as expected and did not add it in my BE.  
 If I removed the 198 dokType it worked for all dokType.  

 *Solution:* 
 After adding the following line infront of the addToAllTCAtypes() call it fixed my problem:  
 *Configuration/TCA/Overrides/pages.php:* 
 <pre><code class="php"> 
 $GLOBALS['TCA']['pages']['types']['198'] = $GLOBALS['TCA']['pages']['types']['1']; 
 </code></pre> 


Back