Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Media Library Not Loading in Grid View #135

Open
jisanpolara opened this issue Sep 3, 2019 · 7 comments
Open

Media Library Not Loading in Grid View #135

jisanpolara opened this issue Sep 3, 2019 · 7 comments

Comments

@jisanpolara
Copy link

The acf-qtranslate plugin is conflicting with media library, If I will disable plugin then media library is working fine.

@bernester
Copy link

same problem here. unfortunately i can not disable the plugin this easaly. terminal prompts the following error
Uncaught TypeError: Cannot read property 'prototype' of undefined at qtranslatex.js?ver=5.2.2:95 at dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3) at r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3) (anonymous) @ qtranslatex.js?ver=5.2.2:95 dispatch @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3 r.handle @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3 load (async) add @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3 a.event.add @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:8 (anonymous) @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3 each @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:2 each @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:2 ra @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3 on @ load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.2.2:3 (anonymous) @ acf-input.min.js?ver=5.8.3:1 (anonymous) @ acf-input.min.js?ver=5.8.3:1

@bichonnages
Copy link

Same thing here.

@pszurgot
Copy link

pszurgot commented Sep 5, 2019

Use ACF 5.8.2 or use qTranslate-XT (it works with acf 5.8.3 and this plugin).

https://support.advancedcustomfields.com/forums/topic/media-library-broken-after-update-to-acf-5-8-3-with-acf-qtranslate/

@jisanpolara
Copy link
Author

Hi,

This plugin is working fine now. Wow.
https://github.com/qtranslate/qtranslate-xt

@NorioTakenaga
Copy link

NorioTakenaga commented Sep 19, 2019

Same issue on my project with ACF 5.8.3.

I commented out a hook on line 75 in acf-qtranslate/src/acf_5/fields/image.php.
Then media library works well.
If anyone want to try, please comment out or remove this line in acf-qtranslate/src/acf_5/fields/image.php.

add_filter('wp_prepare_attachment_for_js',array($this, 'wp_prepare_attachment_for_js'), 10, 3);

or, should change the code like this

    if (method_exists($this, 'wp_prepare_attachment_for_js')) {
			add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3);
    }

acf_qtranslate_acf_5_image class in this file must be an inheritance of acf_field_image class in advanced-custom-fields-pro/includes/fields/class-acf-field-image.php.

But it seems that in ACF 5.8.3, a function (wp_prepare_attachment_for_js) has been removed from the file and a hook using that function is removed too.
It seems that this function has been moved to line 165 in advanced-custom-fields-pro/includes/media.php.
So I think this caused the issue.

I still wonder whether this would be a right solution or not, so I hope somoene will try this.

@sherlockmac
Copy link

I can confirm this works with ACF PRO 5.8.4

acf-qtranslate/src/acf_5/fields/image.php

if (method_exists($this, 'wp_prepare_attachment_for_js')) { 
    add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3);
}

@jlavnv
Copy link

jlavnv commented Dec 30, 2019

thanks @sherlockmac I was very headache with this problem, thank you for sharing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants