Bug #77221

IRRE: l10n_mode (=exclude) not evaluated for translated children

Added by M. Stichweh almost 3 years ago. Updated over 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2016-07-22
Due date:
% Done:

0%

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

Description

A language overlayed $row should be given to the mapRecordTypeToIconIdentifier method to determin the icon class.
That the type of an entity is not needed to be translated should be very common.

History

#1 Updated by Mathias Schreiber almost 3 years ago

  • Category changed from Backend User Interface to FormEngine aka TCEforms

#2 Updated by M. Stichweh almost 3 years ago

I have temporary fixed it with a Xclass of IconFactory:

class IconFactory extends \TYPO3\CMS\Core\Imaging\IconFactory
{
    public function mapRecordTypeToIconIdentifier( $table, array $row )
    {
        if( isset( $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'] ) && 
                isset( $GLOBALS['TCA'][$table]['ctrl']['languageField'] ) &&
                isset( $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] ) &&
                $GLOBALS['TCA'][$table]['columns'][$GLOBALS['TCA'][$table]['ctrl']['typeicon_column']]['l10n_mode'] === 'exclude' &&
                isset( $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] ) && 
                isset( $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] ) ) 
        {
            $sysLanguageUid = $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
            $sysLanguageUid = is_array( $sysLanguageUid )? (int)array_shift( $sysLanguageUid ) : (int)$sysLanguageUid;
            if( $sysLanguageUid > 0 )
            {
                $parentUid = $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']];
                $parentUid = is_array( $parentUid )? (int)array_shift( $parentUid ) : (int)$parentUid;
                if( $parentUid )
                {
                    $column = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
                    if( $rowDefaultLang = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord( $table, $parentUid, $column ) )
                    {
                        $row[$column] = $rowDefaultLang[$column];
                    }
                }
            }
        }

        return parent::mapRecordTypeToIconIdentifier( $table, $row );
    }
}

#3 Updated by Markus Klein almost 3 years ago

  • Status changed from New to Needs Feedback

I'm not sure where the exact bug really is. Actually the row passed into that function should be "ready" (meaning record overlays applied, etc).
Then the value of the typeicon_column should be correct and exclude-mode needs no extra handling anymore.

Can you elaborate how you use that function?

#4 Updated by M. Stichweh almost 3 years ago

Markus Klein wrote:

I'm not sure where the exact bug really is. Actually the row passed into that function should be "ready" (meaning record overlays applied, etc).
Then the value of the typeicon_column should be correct and exclude-mode needs no extra handling anymore.

Can you elaborate how you use that function?

An example of a TCA configuration could be:

$GLOBALS['TCA']['tx_child'] = array(
    'ctrl' => array(
        'title'    => 'Child',
        'label' => 'typecolumn',
        ...,
        'origUid' => 't3_origuid',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'delete' => 'deleted',
        'type' => 'typecolumn',
        'typeicon_column' => 'typecolumn',
        'typeicon_classes' => array(
            '' => 'type-unknown',
            'A' => 'type-a',
            'B' => 'type-b',
            'C' => 'type-c',
        )
    ),
    'columns' => array(
        ...,
        'typecolumn' => array(
            'exclude' => 0,            
            'l10n_mode' => 'exclude',
            'l10n_display' => 'defaultAsReadonly',
            'label' => 'Type',
            'config' => array(
                'type' => 'input',
                'size' => 1,
                'eval' => 'trim'
            ),
        ),
        'parent' => array(
            'config' => array(
                'type' => 'passthrough',
            )
        )
    )
);

$GLOBALS['TCA']['tx_parent'] = array(
    'ctrl' => array(
        'title'    => 'Parent',
        'label' => 'title',
        ...,
        'origUid' => 't3_origuid',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'delete' => 'deleted'
    ),
    'columns' => array(
        ...,
        'children' => array(
            'exclude' => 0,
            'label' => 'Children',
            'config' => array(
                'type' => 'inline',
                'foreign_table' => 'tx_child',
                'foreign_field' => 'parent',
                'maxitems'      => 9999,
                'foreign_default_sortby' => 'typecolumn',
                'appearance' => array(
                    'levelLinksPosition' => 'top',
                    'showSynchronizationLink' => 0,
                    'showPossibleLocalizationRecords' => 1,
                    'showAllLocalizationLink' => 1,
                    'expandSingle' => 1,
                    'collapseAll' => 1,
                    'useSortable' => 0,
                    'enabledControls' => array(
                        'info' => 0,
                        'new' => 1,
                        'dragdrop' => 0,
                        'sort' => 0,
                        'hide' => 0,
                        'delete' => 1,
                        'localize' => 1,
                    ),
                ),
                'behaviour' => array(
                    'localizationMode' => 'select',
                    'localizeChildrenAtParentLocalization' => true,
                    'disableMovingChildrenWithParent' => true,
                )
            )
        )
    )
);

The non-localized column typecolumn is used as type. All inline entries of a localized parent has an empty value for typecolumn and the type class will always be type-unknown.

#5 Updated by Markus Klein almost 3 years ago

  • Subject changed from The TCA configs typeicon_column and typeicon_classes are not working on non-translatable fields (l10n_mode is set to exclude) to IRRE: l10n_mode (=exclude) not evaluated for translated children

#6 Updated by Alexander Opitz over 2 years ago

  • Status changed from Needs Feedback to New

Also available in: Atom PDF