Bug #76141

Problem with !empty() in makeCategorizable usage

Added by Patrick Kroog over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-05-11
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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!

Associated revisions

Revision d3a4f4a7 (diff)
Added by Wouter Wolters over 3 years ago

[BUGFIX] Allow typesList=0 when using makeCategorizable

Due to a wrong condition which is using !empty() typesList=0 is not possible.
Change the condition to check this the correct way.

Resolves: #76141
Releases: master, 7.6
Change-Id: Ieca9bd2a59e42d112c4eb8058bd76da8d73b86ab
Reviewed-on: https://review.typo3.org/48364
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Michael Oehlhof <>
Tested-by: Michael Oehlhof <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision a6da70df (diff)
Added by Wouter Wolters over 3 years ago

[BUGFIX] Allow typesList=0 when using makeCategorizable

Due to a wrong condition which is using !empty() typesList=0 is not possible.
Change the condition to check this the correct way.

Resolves: #76141
Releases: master, 7.6
Change-Id: Ieca9bd2a59e42d112c4eb8058bd76da8d73b86ab
Reviewed-on: https://review.typo3.org/48386
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Patrick Kroog over 3 years ago

Sorry, short info about bug is missing:

Can't add category field with makeCategorizable only to "type" -> "0"

#2 Updated by Gerrit Code Review over 3 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

#3 Updated by Gerrit Code Review over 3 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

#4 Updated by Gerrit Code Review over 3 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

#5 Updated by Gerrit Code Review over 3 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

#6 Updated by Gerrit Code Review over 3 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

#7 Updated by Gerrit Code Review over 3 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

#8 Updated by Wouter Wolters over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#9 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF