-
Notifications
You must be signed in to change notification settings - Fork 108
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
ACF post object titles not translated #678
Conversation
admin/qtx_admin_utils.php
Outdated
@@ -282,7 +282,7 @@ function qtranxf_before_admin_bar_render() { | |||
|
|||
function qtranxf_admin_the_title( $title ) { | |||
//todo this filter should not be used in admin area at all? |
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.
Wondering why this function even exists.
admin/qtx_admin_utils.php
Outdated
@@ -282,7 +282,7 @@ function qtranxf_before_admin_bar_render() { | |||
|
|||
function qtranxf_admin_the_title( $title ) { | |||
//todo this filter should not be used in admin area at all? | |||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )//nav-menus.php#752 | |||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && !is_admin())//nav-menus.php#752 |
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.
But this check is even more restrictive than the admin area, it's only for Ajax calls. Is it really what you intended?
Shouldn't we simply remove the whole |
That would work, but I'm new to the code base, so I don't know why it was put there. |
I won't have much time this week to look at this, but next week i'll try to. |
@hencca sorry for such a long time but finally i tested this. I still have to better understand this old comment: qtranslate-xt/admin/qtx_admin_utils.php Lines 283 to 288 in a8aa6ef
I think the comment only applies to the AJAX case and not the whole filter function. Adding the The risk is that if some async processing requires the raw data then we might do something wrong here. In some cases the raw value might be necessary, especially if it is used by a function writing data in DB! So i tend to believe we rather need to handle the AJAX request for ACF more specifically, at least in a preventive way. Subsidiary question (but not directly related): why is there this special case for nav-menus? Not sure why this is needed. Finally, when is qtranslate-xt/admin/qtx_admin_utils.php Lines 290 to 297 in a8aa6ef
|
@hencca all right, i finally managed to setup xdebug with Docker to better understand what's going on! This change is more complicated than expected:
In that last case, an AJAX call is made and here we don't have the global page. So another filtering is needed, done here with DOING_AJAX and we should keep this case. But i'd say for other AJAX calls i don't think we want the raw value. If we had the autosave feature that could be a problem, but this is disabled by qTranslate... I think i found a good solution by adding a new check on the action itself with |
@hencca i made a small mistake when committing the file, adding the execution bit (due to a mess with WSL). I managed to remove it from the main repo but not on yours. Sorry about that. Ideally you should take the new master from the reference repo. If you have problems with this the best is just to delete the file and check it out again. |
… title