Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag and drop broken in v2 for TYPO3 v10 #332

Closed
mikestreety opened this issue Nov 16, 2022 · 3 comments
Closed

Drag and drop broken in v2 for TYPO3 v10 #332

mikestreety opened this issue Nov 16, 2022 · 3 comments

Comments

@mikestreety
Copy link

Hey,

I've just upgraded to version 2.x on my TYPO3 install (v10.4.32) and it fails when you try and drag and drop items into containers. This doesn't seem to happen on v11 sites.

I get the following error:

image

I have pinned it down to this commit - specifically the removal of this method from Classes/Hooks/Datahandler/DatamapBeforeStartHook.php

    /**
     * @param array $datamap
     * @return array
     */
    protected function extractContainerIdFromColPosInDatamap(array $datamap): array
    {
        if (!empty($datamap['tt_content'])) {
            foreach ($datamap['tt_content'] as $id => &$data) {
                if (isset($data['colPos'])) {
                    $colPos = $data['colPos'];
                    if (MathUtility::canBeInterpretedAsInteger($colPos) === false) {
                        [$containerId, $newColPos] = GeneralUtility::intExplode('-', $colPos);
                        $data['colPos'] = $newColPos;
                        $data['tx_container_parent'] = $containerId;
                    } elseif (!isset($data['tx_container_parent'])) {
                        $data['tx_container_parent'] = 0;
                        $data['colPos'] = (int)$colPos;
                    }
                }
            }
        }
        return $datamap;
    }

adding the call to processDatamap_beforeStart

 $dataHandler->datamap = $this->extractContainerIdFromColPosInDatamap($dataHandler->datamap);

I have added the above method to the latest version of container on my TYPO3 v10 install and it works as expected. I does, however, cause the drag and drop to break in TYPO3 v11.5.19

@mikestreety mikestreety changed the title Drag and drop broken in v2 Drag and drop broken in v2 for TYPO3 v10 Nov 16, 2022
@achimfritz
Copy link
Contributor

Hi @mikestreety does this also happen when you cut and paste the element? Any other extension installed? like gridelement, flux, past_reference? (for last case see #297)
Have you run the container upgrade-migrations (https://github.com/b13/container/releases/tag/2.0.0)?

@mikestreety
Copy link
Author

Hey @achimfritz, thanks for getting back to me.

  • It still happens if you cut and paste elements
  • I didn't realise the migration needed running, thanks

Your links to the issues sent me on a rabbit hole (sorry I didn't spot #297 before) and it turns out it was paste reference.

I have made a pull request with the changes: Kephson/paste_reference#10

@mikestreety
Copy link
Author

As an update, a new version of paste reference (1.0.3) has been released to address and resolve this issue in TYPO3 v10

Kephson/paste_reference@2c8dfea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants