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

Problem with Neo draft behavior #925

Open
stefangallas opened this issue Aug 14, 2024 · 2 comments
Open

Problem with Neo draft behavior #925

stefangallas opened this issue Aug 14, 2024 · 2 comments
Labels
bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required bug report

Comments

@stefangallas
Copy link

Bug Description

Hello, I know that my request is somewhat vague. But unfortunately I have not yet been able to localise the error more precisely. There is a customised plugin that drafts a page including all content elements and then translates all the fields. An event is triggered for each field, via which the field receives its translation data if necessary. This used to work smoothly, but no longer does (without knowing me the time since it fails).

The point is, all standard craft fields on the page are still changed correctly and saved in the draft only. However, for all fields that are within a Neo structure, the translation is saved in both the draft and the regular entry. In this case, it seems as if no draft version of the Neo structure was created at all.

Is there a difference in what happens with a Neo field when a draft version is created in code with

Craft::$app->drafts->createDraft($entry, ...);

and then afterwards (after the translation) is saved via

Craft::$app->getElements()->saveElement($element, false, false);

Or perhaps you have another idea that could explain the different behaviour?

By the way, if I create a draft in the Craft BE everything works out as expected.

Steps to reproduce

Sorry, as that is a custom plugin there is no chance for you to reproduce it.

Expected behaviour

No response

Neo version

4.1.3

Craft CMS version

4.9.5

What is the affected Neo field's propagation method?

Only save blocks to the site they were created in

Does this issue involve templating, and if so, is eager-loading used?

This is not a templating issue

@ttempleton
Copy link
Contributor

If you try this out with a Matrix field, does it work as expected?

@ttempleton ttempleton added bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required and removed bug report status: new labels Aug 17, 2024
@stefangallas
Copy link
Author

Hey @ttempleton , thank you very much for your fast reply. I created a Matrix field and started the translation - and actually have the same behaviour as with the Neo field as described above. Apparently there really is a difference whether fields are built directly into the page or whether they are inside a Neo/Matrix field. So I will contact the Craft team directly - maybe they have an idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required bug report
Projects
None yet
Development

No branches or pull requests

2 participants