All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: “Remove Translation” removes entry’s grid fields for all languages

Status Resolved
Add-on / Version Publisher 3.9.1
Severity
EE Version 6.4.2

Eric Swierczek

Jun 07, 2023

Create an entry in 2+ languages with a grid field with some data. Go to one of the entries and click “Remove Translation”. Load any other language, and the grid data will have been deleted too.

Relevant function trace:
* ext.publisher.php->before_channel_entry_save()
* $this->entryEvent->emit(‘publisherDeleteTranslation’, $entryId, $languageId);
* EntrySubscriber.php->onPublisherDeleteTranslation()
* $entry->delete($entryId, $languageId);
* Entry.php->delete()
* $this->entryEvent->emit(‘publisherDeleteEntry’, $eventArgs);
* EntrySubscriber.php->onPublisherDeleteEntry()
* $fieldHandler->call(‘deleteEntry’, $args);
* which finally calls `GridType.php->deleteEntry()`, which deletes all grid rows for this entry

A potential hacky fix for this might be to adjust `FieldHandler.php->call()` to check:

if (isset($parameters['languageId'])) {
    $parameters['skipEntryDelete'] = true;
}

at the beginning, and then in `GridType.php->deleteEntry()` we can check:

if (isset($params['skipEntryDelete'])) {
    return;
}

GridType.php->delete would also need to be adjusted to accept the parameters that are passed:

public function deleteEntry(array $params = [])

so it skips the entire grid entry deletion event in that case. That at least seemed to work in my test case, but you’d have a better sense of side-effects of this sort of change.

Attached image shows rows in the publisher and grid tables before/after for languages 1 and 4 and removing the translation for lang 4.

 

#1

BoldMinded (Brian)

I think I fixed this in 3.10.1 - from the change log: [Fixed] Refreshing the translation of an entry that contains a Grid field using DeepL or Google would cause all of the Grid data to be erased, even for the default language :(

While this isn’t directly related to DeepL I think it’s the same logic.

#2

BoldMinded (Brian)

Comment has been marked private.

#3

BoldMinded (Brian)

Refreshing the translation calls the same deleteTranslation code.

Login to reply