[ 'config' => [ 'foreign_table_where' => ' AND sys_category.record_type = ' . Constants::CATEGORY_TYPE_BLOG . ' ' . ' AND sys_category.pid = ###CURRENT_PID### ' . ($GLOBALS['TCA']['pages']['columns']['categories']['config']['foreign_table_where'] ?? '') ] ] ]; // Register fields $GLOBALS['TCA']['sys_category']['columns'] = array_replace_recursive( $GLOBALS['TCA']['sys_category']['columns'], [ 'record_type' => [ 'label' => $languageFile . 'sys_category.record_type', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'items' => [ [ 'label' => 'LLL:EXT:blog/Resources/Private/Language/locallang_tca.xlf:sys_category.record_type.blog', 'value' => (string) Constants::CATEGORY_TYPE_BLOG, 'icon' => 'record-blog-category' ] ], 'default' => (string) Constants::CATEGORY_TYPE_BLOG, ] ], 'slug' => [ 'label' => $languageFile . 'sys_category.slug', 'config' => [ 'type' => 'slug', 'generatorOptions' => [ 'fields' => ['title'], 'replacements' => [ '/' => '' ], ], 'fallbackCharacter' => '-', 'eval' => 'uniqueInSite', 'default' => '', 'max' => '2048', ] ], 'posts' => [ 'label' => $languageFile . 'sys_category.posts', 'config' => [ 'type' => 'group', 'size' => 5, 'allowed' => 'pages', 'foreign_table' => 'pages', 'MM' => 'sys_category_record_mm', 'MM_match_fields' => [ 'fieldname' => 'categories', 'tablenames' => 'pages', ], 'maxitems' => 1000 ], ], ] ); // Add slug field to all types ExtensionManagementUtility::addToAllTCAtypes( 'sys_category', 'slug', '', 'after:title' ); // Add blog specific fields to blog categories ExtensionManagementUtility::addToAllTCAtypes( 'sys_category', ' --div--;' . $languageFile . 'sys_category.tabs.blog, posts ', (string) Constants::CATEGORY_TYPE_BLOG );