Bug #76141
closedProblem with !empty() in makeCategorizable usage
100%
Description
Steps to face this bug:
- Add a TCA-Definition for a table with 2 or more "types".
- Try to ONLY add the category field to the first type, which is type "0" (using makeCategorizable and use "typesList" in option Array...)
For example:
// Add an extra categories selection field to the pages table \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( 'eventmanager', 'tx_eventmanager_domain_model_event', 'category', array( 'typesList' => '0', 'label' => 'LLL:EXT:eventmanager/Resources/Private/Language/locallang_db.xlf:tx_eventmanager_domain_model_event.category', 'exclude' => true, 'fieldConfiguration' => array( ... ) ), 'l10n_mode' => 'exclude', 'l10n_display' => 'hideDiff', ) );
The typesList is now ignored, and the category field is added to ALL types as TYPO3\CMS\Core\Category\CategoryRegistry::addToAllTCAtypes checks the typesList option like this:
$typesList = ''; if (!empty($options['typesList'])) { $typesList = $options['typesList']; }
So, as a workaround one could use a typesList like this, but as it's not documented, one wouldn't understand why the default configuration doesn't work:
// Add an extra categories selection field to the pages table \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( 'eventmanager', 'tx_eventmanager_domain_model_event', 'category', array( 'typesList' => '0,999', 'label' => 'LLL:EXT:eventmanager/Resources/Private/Language/locallang_db.xlf:tx_eventmanager_domain_model_event.category', 'exclude' => true, 'fieldConfiguration' => array( ... ) ), 'l10n_mode' => 'exclude', 'l10n_display' => 'hideDiff', ) );
So this check should be corrected!
Updated by Patrick Kroog over 8 years ago
Sorry, short info about bug is missing:
Can't add category field with makeCategorizable only to "type" -> "0"
Updated by Gerrit Code Review over 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48364
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48364
Updated by Gerrit Code Review over 8 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48364
Updated by Gerrit Code Review over 8 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48364
Updated by Gerrit Code Review over 8 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48364
Updated by Gerrit Code Review over 8 years ago
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48386
Updated by Wouter Wolters over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d3a4f4a7697a4b033c9837e788e86ca15666c26f.