TYPO3 CMS 6+: show only certain system categories (sys_category) in the wizard / zeige nur bestimmte Kategorien (sys_category) im System-Kategorien Wizard

Let’s say you want to use the new TYPO3 CMS 6.x+ system categories (sys_category) in your own extension.

As the name suggests these are system-wide categories, so the category tree can be very large and may show categories you don’t want to use/show for your special record type.

To limit the categories in the category wizard for your own records, take the following steps:

  • save your category records in different folders per type, e.g. in a folder with PID 135 (categories for type A) and another with PID 136 (categories for type B)
  • save your A records in a separate folder, e.g. in a folder with PID 142

and set the following PageTS (Edit page > Resources > Page TSConfig) on the folder with your type A records (PID 142)

TCEFORM {
  tx_myext_domain_model_something.categories {
    PAGE_TSCONFIG_ID = 135
  }
}

tx_myext_domain_model_something is the name of the database table and
categories is the column name you use for the categories relation (you might have given it another name).

and use this value in your makeCategorizable call:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
  'myext', 
  'tx_myext_domain_model_something', 
  'categories', array(
    'fieldConfiguration' => array(
      'foreign_table_where' => 
         ' AND sys_category.pid = ###PAGE_TSCONFIG_ID### '
    )
  )
);

and the wizard will only display the categories in the specified folders :-)

Anfrage