Bug #89784

Copy Contentelement "Text with Media" - Media is missing in the new element

Added by Andreas Fragner 11 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-11-27
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

When I copy a CE of type "Text with Media" the files are missing in the new CE. Only content from RTE is copied but no file relations.
Same result when I copy the whole page. Content elements are copied without file relations.

History

#1 Updated by Riccardo De Contardi 11 months ago

  • Status changed from New to Needs Feedback

I can't reproduce this issue, even with a non-admin user. Can you share more information about how to reproduce this issue?

Please specify for example:

- a step-by-step list of all the operations you did
- user and usergroup configuration and privileges

#2 Updated by Andreas Fragner 11 months ago

Here is my Step-By-Step List:

1.) Login as Admin
2.) Left Menu Select "PAGE"
3.) In the Page-Tree select the page
4.) Rioght Click on a content element of type "Text and Media" and choose "COPY"
5.) Click the icon for pasting the CE
6.) The following question if reference or copy choose "COPY"

The I have a CE without images.

The source CE is including severeal images and nothing else.

The same is happening if I copy a whole page. Content-Elements get copied, but file references are not copied.

#3 Updated by Riccardo De Contardi 11 months ago

  • Status changed from Needs Feedback to New

#4 Updated by Riccardo De Contardi 11 months ago

  • Status changed from New to Needs Feedback

6.) The following question if reference or copy choose "COPY"

Are you using EXT:gridelements? IIRC the "paste as reference" button is added by that extension. Maybe you perform your copy inside a grid element?

#5 Updated by Andreas Fragner 11 months ago

Yes I'm using EXT:gridelements, but this bug I'm not copying content elements inside a gridelement.
To reproduce this bug I create a content element without a surrouding gridelement.

Just to be sure I just created a new empty page in this installation without any content elements. On this page I created a new CE "text and media" an inserted 3 existing images from the fileadmin folder. After saving the newly created CE I tried to copy it - same result: no filereferences in the new copy. I did not use any gridelement on the new page.

So how can this be influenced by gridelements when gridelements are not used on the newly created page in this typo3 instance?

#6 Updated by Riccardo De Contardi 11 months ago

  • Status changed from Needs Feedback to New

#7 Updated by Andreas Fragner 9 months ago

Please let me know how I can help to solve this issue - I think it is only occuring when updating a Typo3 V8 installation to Typo3 V9. I have here a fresh Typo3 V10 installation where this bug is not reproducable. I'll try to get a fresh V9 installation with introduction package to test if this issue also exists.
Maybe some database dumps could be helpful to solve this issue?

Update: fresh installation with introduction package: the problem is not occuring - so how can we solve this or how can we find out why this is happening in my upgraded installations?

#8 Updated by Andreas Fragner 8 months ago

I think I have found the reason why media ressources are not copied. I have created an own content element called "responsive video"

In the TCA override of tt_content I have the following lines:

$fields = array(
    'videosource' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', array(
            'appearance' => array(
                'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references.addFileReference'
            ),
            // custom configuration for displaying fields in the overlay/reference table
            // behaves the same as the image field.
            'overrideChildTca' => array(
                'types' => array(
                    '0' => array(
                        'showitem' => '
                                --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                                --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
                        'showitem' => '
                                --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.videoOverlayPalette;videoOverlayPalette,
                                --palette--;;filePalette'
                    ),
                    \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
                        'showitem' => '
                                --palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                                --palette--;;filePalette'
                    )
                ),
            ),
            'maxitems' => 1,
            ), 'mp4,youtube,vimeo')
    ),
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $fields);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    array(
        'LLL:EXT:theme/Resources/Private/Language/locallang_be.xlf:content.responsivevideo',
        'theme_responsivevideo',
        'EXT:theme/Resources/Public/Backend/Icons/theme_responsivevideo.svg'
    ), 'CType', 'theme'
);

// Responsive video
$GLOBALS['TCA']['tt_content']['types']['theme_responsivevideo'] = array(
    'showitem' => '
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
            --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
            --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.media,
            videosource,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
            --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
            --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
            --palette--;;language,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
            --palette--;;hidden,
            --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
            categories,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
            rowDescription,
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
    ',
);

In my ext_tables.sql script I have

CREATE TABLE tt_content (
       videosource int(11) unsigned DEFAULT '0' NOT NULL,
);

And in the template I am assigning my content element "responsive video" to a fluid template

tt_content {
   theme_responsivevideo =< tt_content.textmedia
   theme_responsivevideo {
      templateName = Responsivevideo
   }
}

So there must be somethin in these lines that is not compatible with Typo3 V9.5 - but I cannot see what is wrong - maybe you can help me?

#9 Updated by Riccardo De Contardi 8 months ago

umm I don't know.. for now I would suggest you to ask for help on Slack

#10 Updated by Andreas Fragner 8 months ago

OK my own content element "responsive video" is working again... replaced

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    array(
        'LLL:EXT:theme/Resources/Private/Language/locallang_be.xlf:content.responsivevideo',
        'theme_responsivevideo',
        'EXT:theme/Resources/Public/Backend/Icons/theme_responsivevideo.svg'
    ), 'CType', 'theme'
);

by
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
    array(
        'LLL:EXT:theme/Resources/Private/Language/locallang_be.xlf:content.responsivevideo',
        'theme_responsivevideo',
        'EXT:theme/Resources/Public/Backend/Icons/theme_responsivevideo.svg',
    ),
    'textmedia',
    'after'
);

Still no copying of content elements possible...

#11 Updated by Andreas Fragner 8 months ago

  • Complexity set to easy
$fields = array(
    'videosource' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('assets', array(

was absolutely wrong...
replaced it by

$fields = array(
    'videosource' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.asset_references',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('videosource', array(

and used the right field in my template and now everything is working again... so it's a little bit buggy 8.7 that had no problem with my faulty code :-)

Sometimes errors are hard to find especially when self coded... :-)

This task can be closed - no bug, just working as expected.

#12 Updated by Riccardo De Contardi 8 months ago

  • Status changed from New to Closed

@Andreas Fragner Thank you for your time and your reply; I close this issue as requested.

If you think that this is the wrong decision or there is still something that can be done, please reopen it or ping me.

Also available in: Atom PDF