Bug #54530

FAL Media Element cannot be expanded when fieldname contains undescores

Added by Jan Greth almost 6 years ago. Updated almost 2 years ago.

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

100%

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
);

[...]

TYPO3_CMS_6.1_irre_error.jpg View - Firebug screenshot with "_header" (54.6 KB) Thomas Schwarz, 2014-01-20 12:05

TYPO3_CMS_6.1_irre_working_1.jpg View - Firebug screenshot with renamed db field (first request) (164 KB) Thomas Schwarz, 2014-01-20 12:05

TYPO3_CMS_6.1_irre_working_2.jpg View - Firebug screenshot with renamed db field (second request) (59.8 KB) Thomas Schwarz, 2014-01-20 12:05

Associated revisions

Revision 07ef3bfb (diff)
Added by Mathias Schreiber almost 4 years ago

[BUGFIX] Use less aggressive string replace in IRRE headers

The current way of cutting out the _header portion of an IRRE header was
too aggressive and might cut of unwanted parts of the id attribute.
We change the regex to only check on the end of the string to fix this.

Resolves: #54530
Releases: master
Change-Id: I935d93ad1eca7f2599ab6a91845e2fe363a9719a
Reviewed-on: http://review.typo3.org/44104
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Morton Jonuschat <>
Tested-by: Morton Jonuschat <>

History

#1 Updated by Frans Saris almost 6 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.

#2 Updated by Thomas Schwarz over 5 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.

#3 Updated by Robert Heinig over 5 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.

#4 Updated by Mathias Schreiber almost 5 years ago

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

#5 Updated by Riccardo De Contardi about 4 years ago

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

#6 Updated by Susanne Moog about 4 years ago

  • Target version changed from 7.4 (Backend) to 7.5

#7 Updated by Benni Mack about 4 years ago

  • Target version changed from 7.5 to 7 LTS

#8 Updated by Gerrit Code Review almost 4 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

#9 Updated by Gerrit Code Review almost 4 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

#10 Updated by Mathias Schreiber almost 4 years ago

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

#11 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF