Project

General

Profile

Actions

Bug #54530

closed

FAL Media Element cannot be expanded when fieldname contains undescores

Added by Jan Greth over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend User Interface
Target version:
Start date:
2013-12-20
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When adding a new field to a existing table (e.g. pages) for adding Media (Images with custom palette) as IRRE, this field's name cannot have undescores ("_") in its name.

Otherwise the created IRRE Data cannot be expanded when saving this page and editing it again.

NOT working:

ext_tables.sql
[...]

#
# Table structure for table 'pages'
#
CREATE TABLE pages (

    slideshow tinyint(1) unsigned DEFAULT '0' NOT NULL,
    dynamic_header_images int(11) unsigned DEFAULT '0' NOT NULL,

);

[...]

ext_tables.php
[...]

$addColumnArray = array(
    'slideshow' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:slideshow_on_off',
        'config' => array(
            'type' => 'check'
        )
    ),
    '*dynamic_header_images*' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:dynamic_header_images',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('*dynamic_header_images*', array(
                'appearance' => array(
                    'createNewRelationLinkTitle' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:*dynamic_header_images*.add_reference',
                ),
                'foreign_types' => array(
                    '0' => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    )
                )
            ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
        ),
    ),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $addColumnArray);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', '--div--;LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:dynamic_header_tab,slideshow,*dynamic_header_images*');

$addColumnArray = array(
    'headline' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:headline',
        'config' => array(
            'type' => 'input',
            'size' => 48,
            'max' => 256
        )
    ),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $addColumnArray);

$GLOBALS['TCA']['sys_file_reference']['palettes']['dynamicHeaderPalette'] = array(
    'showitem' => 'title,alternative;;;;3-3-3,--linebreak--,link,description,--linebreak--,headline',
    'canNotCollapse' => TRUE
);

[...]

working:

ext_tables.sql
[...]

#
# Table structure for table 'pages'
#
CREATE TABLE pages (

    slideshow tinyint(1) unsigned DEFAULT '0' NOT NULL,
    dynamicheaderimages int(11) unsigned DEFAULT '0' NOT NULL,

);

[...]

ext_tables.php
[...]

$addColumnArray = array(
    'slideshow' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:slideshow_on_off',
        'config' => array(
            'type' => 'check'
        )
    ),
    '*dynamicheaderimages*' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:dynamicheaderimages',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('*dynamicheaderimages*', array(
                'appearance' => array(
                    'createNewRelationLinkTitle' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:*dynamicheaderimages*.add_reference',
                ),
                'foreign_types' => array(
                    '0' => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
                        'showitem' => '
                            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;dynamicHeaderPalette,
                            --palette--;;filePalette'
                    )
                )
            ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
        ),
    ),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $addColumnArray);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', '--div--;LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:dynamic_header_tab,slideshow,*dynamicheaderimages*');

$addColumnArray = array(
    'headline' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:mp_dynamicheader/Resources/Private/Language/locallang_db.xlf:headline',
        'config' => array(
            'type' => 'input',
            'size' => 48,
            'max' => 256
        )
    ),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $addColumnArray);

$GLOBALS['TCA']['sys_file_reference']['palettes']['dynamicHeaderPalette'] = array(
    'showitem' => 'title,alternative;;;;3-3-3,--linebreak--,link,description,--linebreak--,headline',
    'canNotCollapse' => TRUE
);

[...]


Files

TYPO3_CMS_6.1_irre_error.jpg (54.6 KB) TYPO3_CMS_6.1_irre_error.jpg Firebug screenshot with "_header" Thomas Schwarz, 2014-01-20 12:05
TYPO3_CMS_6.1_irre_working_1.jpg (164 KB) TYPO3_CMS_6.1_irre_working_1.jpg Firebug screenshot with renamed db field (first request) Thomas Schwarz, 2014-01-20 12:05
TYPO3_CMS_6.1_irre_working_2.jpg (59.8 KB) TYPO3_CMS_6.1_irre_working_2.jpg Firebug screenshot with renamed db field (second request) Thomas Schwarz, 2014-01-20 12:05
Actions #1

Updated by Frans Saris over 10 years ago

Are you sure you have no configuration errors?

Did a FAL implementation for ext:news with a underscore in the fieldname and it works.
See https://review.typo3.org/#/c/25550/

Only difference is it only has 1 underscore.

Updated by Thomas Schwarz over 10 years ago

I have the same problem.

Underscores in the DB are not the Problem. The Problem are the Phrase "_header" in the DB field name, in my examle "tx_mpcontent_header_icon".

With "_header" in the DB field name the post params of the ajax-request (on opening the irre element) looks like Firebug Screenshot 1 and gets no Content in Answer.

Without "_header" (renamed to "_dheader") the post params of the two ajax-request looks like Screenshot 2 and 3.

Actions #3

Updated by Robert Heinig almost 10 years ago

This bug is caused in
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js
where in line 62 (TYPO3 6.2.3)

recordHeader.attr('id').replace('_header', ''),

is too aggressive.
This could be solved with
recordHeader.attr('id').replace(/_header$/, ''),

But a better solution would be to avoid replacing here at all.

Actions #4

Updated by Mathias Schreiber over 9 years ago

  • Target version changed from next-patchlevel to 7.4 (Backend)
Actions #5

Updated by Riccardo De Contardi over 8 years ago

I see that the js line reported is still present in 7.4-dev (latest master)

Actions #6

Updated by Susanne Moog over 8 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #7

Updated by Benni Mack over 8 years ago

  • Target version changed from 7.5 to 7 LTS
Actions #8

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 http://review.typo3.org/44104

Actions #9

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 http://review.typo3.org/44104

Actions #10

Updated by Mathias Schreiber over 8 years ago

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

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF