-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
[5.x] Fix wrong url on the link mark node in bard fieldtype #11207
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you but that code is there for a reason. See the PR where it was added for context. #8319
I think that maybe we could just avoid localizing if we're in an API.
-if ($item instanceof Entry) {
+$isApi = Str::startsWith(request()->path(), [config('statamic.api.route'), 'graphql']);
+
+if (!$isApi && $item instanceof Entry) {
(I haven't tested that code - I just wrote it straight into the comment)
@jasonvarga I updated the PR. I add two checks: One for the Rest-API and another for Graphql. I tested the changes in our project with the bug and it works fine. |
Just a note: However, the more I think about it, the more I see this as a temporary fix. I have already noticed in other places that the site handling does not always work correctly and Site::current() returns the default site in many cases, even though you are on a different site in the context. I honestly think that this is a global problem in the CMS. Because changing a page in the control panel is often solved differently. Personally, I find this rather confusing and would like a more centralized handling here, then I also think the original code would not be possible without the fix from me. I'm happy to contribute on how to optimize this, but I don't think I'd be the person to implement it as I'm not too deep in the code. A first central solution would be, for example, a middleware that takes care of the site handling and injects the requests (whether API or views). |
Yeah we know the top bar is confusing. statamic/ideas#350 |
Goes along with #11206