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

ACF Pro 6.0 #1227

Closed
salt-istanbul opened this issue Sep 23, 2022 · 11 comments
Closed

ACF Pro 6.0 #1227

salt-istanbul opened this issue Sep 23, 2022 · 11 comments
Labels
module: ACF Integration with ACF

Comments

@salt-istanbul
Copy link

Hi,
qtranslate-xt / acf integration not working with ACF Pro 6.0.

@Komarovski
Copy link
Contributor

Komarovski commented Sep 24, 2022

Here's a quick fix for front-end, add this function to your functions.php file:

function qtranslate_filter_acf_fields($value, $post_id, $field){
$value = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
return $value;
}
add_filter('acf/format_value/type=file', 'qtranslate_filter_acf_fields', 10, 3);
add_filter('acf/format_value/type=image', 'qtranslate_filter_acf_fields', 10, 3);
add_filter('acf/format_value/type=post_object', 'qtranslate_filter_acf_fields', 10, 3);
add_filter('acf/format_value/type=text', 'qtranslate_filter_acf_fields', 10, 3);
add_filter('acf/format_value/type=textarea', 'qtranslate_filter_acf_fields', 10, 3);
add_filter('acf/format_value/type=url', 'qtranslate_filter_acf_fields', 10, 3);
add_filter('acf/format_value/type=wysiwyg', 'qtranslate_filter_acf_fields', 10, 3);

@salt-istanbul
Copy link
Author

salt-istanbul commented Sep 24, 2022

Thanks @Komarovski
but the most important problem there's no any qtranslate-xt field option on ACF field group page.

acf-pro-v6 0 0

@herrvigg herrvigg added the module: ACF Integration with ACF label Sep 25, 2022
@MKRD-SUPPORT
Copy link

Version 6 is currently not supported, so I would recommend not using it just yet.
In addition, many problems with version 5 still need to be fixed. To this day I still don't understand why the QTX plugin clones the ACF fields.

If you still want to use ACF(-PRO) 6+, you must first allow this in the acf_qtranslate_plugin class:

init()
acf_enabled()

@herrvigg herrvigg added the help wanted Extra attention is needed label Oct 22, 2022
@herrvigg
Copy link
Collaborator

herrvigg commented Oct 23, 2022

Version 6 is currently not supported, so I would recommend not using it just yet.
If you still want to use ACF(-PRO) 6+, you must first allow this in the acf_qtranslate_plugin class:
init()
acf_enabled()

All of this is obsolete with qTranslate-XT 3.12.1 released Sept 4. The acf_qtranslate_plugin class doesn't exist anymore (see #1191 and #1187).
The new qtranxf_acf_init allows any ACF >= 5.0.0.
But it's possible some things are broken with ACF 6, I haven't tried it yet. Please update your QT-XT to latest version.

@herrvigg
Copy link
Collaborator

herrvigg commented Nov 5, 2022

@salt-istanbul @Komarovski @MKRD-SUPPORT Which qTranslate-XT version are you using?

I can't reproduce the problem with ACF 6.0.3 Free.
It should work already with qTranslate-XT 3.12.1 that was released September 4 so it's been already available for quite some time.
It wasn't an intentional fix for ACF6 that I wasn't even aware of at that time but I extended the support of any ACF >= 5.0.0.
I don't think it should be different with ACF 6 Pro for the main functionalities. There's a specific issue for custom ACF option pages reported in #1233 but I'm not able to see this with ACF free.

To this day I still don't understand why the QTX plugin clones the ACF fields.

I'm not the original author, but I guess the main reason was because the rendering of translated fields is specific to the current language. Perhaps that could be handled differently with hooks instead of registering new fields?

@herrvigg
Copy link
Collaborator

herrvigg commented Nov 5, 2022

To this day I still don't understand why the QTX plugin clones the ACF fields.

In fact there's an option in the qTranslate / ACF tab called "Enable translation for Standard Field Types". If you tick that, it will enable the ML support for ACF fields: text, textarea, wysiwyg - though there's a known problem with wysiwyg reported in #1186. I don't know yet why it's only for those fields, perhaps it could be extended.

@herrvigg herrvigg removed the help wanted Extra attention is needed label Nov 5, 2022
@MKRD-SUPPORT
Copy link

In the production environment I will not update to the current state of the plugin: ACF(-Pro) 5.12.3, QTX 3.11.0

I'm sorry, but I don't have time to deal with the plugin in the near future.

@herrvigg
Copy link
Collaborator

herrvigg commented Nov 5, 2022

To me there's no major problem with ACF6, it works but you need QTX 3.12.1 or later.
Let's see what the others say.

@herrvigg
Copy link
Collaborator

herrvigg commented Nov 5, 2022

However I will keep this ticket open for this problem with the ACF group title.
image

There's a regression with ACF6 because they removed the form... so QT-XT can't send the current language being edited... the switching buttons have move down, they seem to work but only the last language is saved and it overwrites the others 😕

Error in the console log
No form found for translatable field id= title

Fortunately it's only for the title so it's a minor issue. The switching buttons work and the hidden fields are created correctly though, so there's some hope to fix that.

@herrvigg
Copy link
Collaborator

herrvigg commented Nov 5, 2022

Just in case, if you want a quicker and simpler fix on an older version of QT-XT just change these lines:

if ( $this->acf_major_version() === 5 ) {

return $this->acf_major_version() === 5;

Replace the check

 $this->acf_major_version() === 5

with

$this->acf_major_version() >= 5

That should do the job to keep most of the QT-XT module for ACF working without adding any code. You can even remove the version checks completely for temporary tests. I realized it was artificially limited so I changed that in 3.12.1 along with a lot of code refactoring. The rest should not impact the existing functionalities at all.

@herrvigg
Copy link
Collaborator

Since this topic was created for another reason about the ACF version, better have a separate issue for field title: #1252 .
The current issue should be solved already with QTX 3.12.1.
Note there was also a regression with the LSB #1233 but it's unrelated to ACF6, already fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: ACF Integration with ACF
Projects
None yet
Development

No branches or pull requests

4 participants