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

Craft 5 Issue Applying Draft #518

Closed
LinneaHarts opened this issue Sep 5, 2024 · 25 comments
Closed

Craft 5 Issue Applying Draft #518

LinneaHarts opened this issue Sep 5, 2024 · 25 comments
Assignees
Labels
priority: high To be merged ASAP

Comments

@LinneaHarts
Copy link

When trying to Merge and Apply a Draft, I keep getting a "title" array key not found error. There is a Craft 5 release of this out, but the Craft 5 support ticket hasn't been closed yet, so I'm confused if this release is ready or not.

@MerrittBoydston
Copy link
Collaborator

🆕 Updates

  • @LinneaHarts, we are taking a look into this error right now and will have a response to you as soon as possible.

@LinneaHarts
Copy link
Author

I found this error was in the NeoFieldTranslator.php file, trying to send a title into the Neo blocks. Not sure why that was added in Crart 5, but removing it fixed this issue.

I've found a number of other issues with field handles though.

@MerrittBoydston
Copy link
Collaborator

Thank you for the quick follow-up.

We initially discovered this bug but were unsure if it was specific to neo field or more widespread. However, your confirmation has been helpful. The plan is to push a fix for this tomorrow.

Can you describe the issues you're experiencing with field handles?

@LinneaHarts
Copy link
Author

Because Craft 5 created so many more field handles (and it seems like they are not always stored consistently) I was getting errors when I created new orders, saying, for instance "field handle cta3 not found". I added a try catch block in HyperLinkFieldTranslator and AssetFieldTranslator to handle the errors I saw, but there may be others. I haven't tested entries with every field type.

https://github.com/imarc/craft-translations/blob/f7db5162c1098d5637d59f2b3ffa0a3af2a47e60/src/services/fieldtranslator/HyperLinkFieldTranslator.php#L31
https://github.com/imarc/craft-translations/blob/a7407e219d734babdd623ef7a0d3a6f19591d2ae/src/services/fieldtranslator/AssetsFieldTranslator.php#L28

(I'm maintaining a separate fork that has a ChatGPT connector for a client -- who is paying for the license -- so I've been debugging myself.)

@MerrittBoydston MerrittBoydston added the priority: high To be merged ASAP label Sep 6, 2024
@MerrittBoydston
Copy link
Collaborator

Thank you for the detailed information. We'll continue working on this and communicate with you in this ticket.

@MerrittBoydston
Copy link
Collaborator

Hi @LinneaHarts, we have a new beta release v4.0.0-beta.2 that should fix your issue.

@LinneaHarts
Copy link
Author

I can't test if this will work because it can't create an order without also giving an "Invalid field handle" error for any new fields that Craft 5 created.

@LinneaHarts
Copy link
Author

Sorry, this was because I hadn't converted my SuperTable fields yet. I was able to successfully create an order. Now trying to process it!

@LinneaHarts
Copy link
Author

No, this is still having the same problem with applying drafts. I'm getting invalid field handles and the only way to fix it is using craft's merge capabilities, but that causes other problems.

@sidedwards
Copy link
Collaborator

Hi @LinneaHarts, thank you for your patience as we refine the Craft 5 beta.

Could you share some specific steps to reproduce the issue you're experiencing? Screenshots or screen recordings are very helpful for our team to identify and resolve more quickly.

@MerrittBoydston
Copy link
Collaborator

Hello @LinneaHarts, I wanted to follow up here on @sidedwards request.

@LinneaHarts
Copy link
Author

I'm afraid I'm not a great example because I do maintain a separate branch of the plugin to add a ChatGPT translator. I fixed my own issues on this particularly client site by using Craft's merge command on the fields it was complaining about, as well as adding this code to the field translators.

try {
            $blocks = $element->getFieldValue($field->handle);
            $fieldHandle = $field->handle;
        } catch (\Exception $e) {
            $blocks = $element->getFieldValue(preg_replace('/\d+$/', '', $field->handle));
            $fieldHandle = preg_replace('/\d+$/', '', $field->handle);
        }

@MerrittBoydston
Copy link
Collaborator

@LinneaHarts - it looks like this may has been resolved, do you mind testing this again on your end?

@MerrittBoydston
Copy link
Collaborator

Hi @LinneaHarts - just following up here again

@LinneaHarts
Copy link
Author

I just got a chance to test this yesterday. I think it's working! Bearing in mind that I merged your update into my own fork. Thanks!

@MerrittBoydston
Copy link
Collaborator

I just got a chance to test this yesterday. I think it's working! Bearing in mind that I merged your update into my own fork. Thanks!

Great, thank you @LinneaHarts, feel free to open another ticket if you run into any other complications.

@LinneaHarts
Copy link
Author

Actually, with further testing, there may be something going on. Stand by

@LinneaHarts
Copy link
Author

No, the problem is persisting. It is having trouble with hyper fields at the moment, perhaps others.

@MerrittBoydston
Copy link
Collaborator

No, the problem is persisting. It is having trouble with hyper fields at the moment, perhaps others.

@LinneaHarts - we'll continue looking into this.

If we need any more information from you, like steps for repro, we'll touch base here.

@LinneaHarts
Copy link
Author

LinneaHarts commented Oct 23, 2024

I do have it more-or-less working on this fork/branch https://github.com/imarc/craft-translations/tree/chatgpt-craft5

@LinneaHarts
Copy link
Author

LinneaHarts commented Oct 29, 2024

When I did a merge on the offending field using the fields/merge command, I was able to merge, but now it's creating a new revision that removes all the content in the source language.

@LinneaHarts
Copy link
Author

I was able to fix this by adding the following code from line 100-112 https://github.com/imarc/craft-translations/blob/chatgpt-craft5/src/services/repository/EntryRepository.php#L100

@sidedwards
Copy link
Collaborator

@LinneaHarts thank you for the update. We will investigate this further and review your proposed solution. Thanks for your patience on this issue 🙏

@sidedwards
Copy link
Collaborator

@LinneaHarts, would you mind testing this again with the latest version to see if that resolves your issue? The code you mentioned above is included here:

https://github.com/AcclaroInc/craft-translations/blob/a26aa6e6c1e087c2f30b7c266e9a3f5a2a4f05ab/src/services/repository/EntryRepository.php#L106C13-L118C27

@MerrittBoydston
Copy link
Collaborator

Hi @LinneaHarts, just following up here on @sidedwards' comment. Let me know if this resolves your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high To be merged ASAP
Projects
None yet
Development

No branches or pull requests

4 participants