Project

General

Profile

Actions

Bug #86985

open

itemsProcFunc for select->selectSingle shows key instead of label in page translation

Added by NGUYEN Duc Quan over 5 years ago. Updated over 2 years ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2018-11-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hi,

I noticed that when using 'itemsProcFunc' I get a strange behaviour when translating a page. When translating the page in the BE then the key is shown instead of the label. This behaviour doesn't appear to be when using 'items' to render a select list. Shouldn't the label be shown instead of the key like it is for rendering lists with 'items'? Or am I missing an implementation step?

...

// Here's the snippet from the tca where I override pages
    'tx_abcde_blog_media_type' => [
        'exclude' => 0,
        'label' => 'Blog type',
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'itemsProcFunc' => "XYZ\\Abcde\\Lists\\MediaTypes->tcaMediaTypes",
        ],
        'displayCond' => 'FIELD:tx_abcde_blog_content_type:!=:category',
    ]

...

// Here are the functions I am using

    static public function tcaMediaTypes($config){
        $config['items'] = \XYZ\\Abcde\Helper\TCA::arrayToList(self::mediaTypes());
        return $config;
    }

    static function mediaTypes()
    {

        return [
            0 => Languages::translate('blog.mediatypes.0'),
            1 => Languages::translate('blog.mediatypes.1'),
            2 => Languages::translate('blog.mediatypes.2'),
            3 => Languages::translate('blog.mediatypes.3')
        ];

    }

    public static function arrayToList($aArray)
    {

        $list = [];

        foreach ($aArray as $key => $value) {
            $list[] = [$value, $key];
        }

        return $list;

    }

...

I attached a screenshot !Screen Shot 2018-11-23 at 11.50.23.png! to show the issue.


Files

Screen Shot 2018-11-23 at 11.50.23.png (72 KB) Screen Shot 2018-11-23 at 11.50.23.png NGUYEN Duc Quan, 2018-11-23 14:10
Screenshot 2018-11-27 at 12.05.01.png (37.1 KB) Screenshot 2018-11-27 at 12.05.01.png Result of a translated page Filipe DA COSTA COSTA, 2018-11-27 12:05

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #54131: getLabelsFromItemsList doens't return any values when no item foundClosed2013-12-02

Actions
Actions

Also available in: Atom PDF