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

Media gallery doest not appear for image field #1265

Open
MrZyr0 opened this issue Nov 22, 2024 · 6 comments
Open

Media gallery doest not appear for image field #1265

MrZyr0 opened this issue Nov 22, 2024 · 6 comments

Comments

@MrZyr0
Copy link

MrZyr0 commented Nov 22, 2024

Version

  • Carbon Fields: 3.6.5
  • WordPress: 6.7.1
  • PHP: 8.1.30

Expected Behavior

When I click on the button "Select Image" Screenshot 2024-11-22 at 11 00 18, the WordPress media gallery should appear

Actual Behavior

Clicking does nothing

Container definition

Block::make('images-grid', __('Images grid', 'example-com'))
    ->set_description(__('Massonery pictures grid', 'example-com'))
    ->set_category('media')
    ->set_icon('grid-view')
    ->set_keywords([__('massonery', 'example-com'), __('media', 'example-com'), __('pictures', 'example-com'), __('photos', 'example-com'), __('gallery', 'example-com'), __('slider', 'example-com')])
    ->set_mode('both')
    ->add_fields([
      Field::make('text', 'total_columns', __('Grid width', 'example-com'))
        ->set_attribute('type', 'number')
        ->set_attribute('min', 1)
        ->set_attribute('max', 12)
        ->set_default_value(4)
        ->set_help_text(__('Define the number of grid columns.', 'example-com')),
      Field::make('complex', 'masonry_images', __('Images', 'example-com'))
        ->add_fields(array(
          Field::make('image', 'image', __('Image', 'example-com'))
            ->set_type('image')
            ->set_value_type('url'),
          Field::make('text', 'columns', __('Columns size', 'example-com'))
            ->set_attribute('type', 'number')
            ->set_attribute('min', 1)
            ->set_attribute('max', 12)
            ->set_default_value(1)
            ->set_help_text(__('Indicate the space taken up by the image in width.', 'example-com')),
          Field::make('text', 'rows', __('Lines size', 'example-com'))
            ->set_attribute('type', 'number')
            ->set_attribute('min', 1)
            ->set_default_value(1)
            ->set_help_text(__('Indicate the space taken up by the image in height.', 'example-com'))
        ))
        ->set_min(1)
        ->set_help_text(__('Add images to fill the grid.', 'example-com')),
    ])

Steps to Reproduce the Problem

  1. Create new page
  2. Add the block
  3. Add an entry to the complex
  4. Try to select an image

Comments

According to my investigations, there would be a problem declaring the event because I have several sites on the same environment (similar Docker declaration with the same theme, the same version of WordPress and the same plugins under the same version) and I do not have the same attached function.

For the site with a functional button I have un() which has executable code, but for the site that does not work I have noop() which is an empty function.

Here is some screenshots from the devtool of my non working website :

Screenshot 2024-11-22 at 11 10 27 Screenshot 2024-11-22 at 11 10 48

Here is some screenshots from the devtool of my working website :

Screenshot 2024-11-22 at 11 12 54 Screenshot 2024-11-22 at 11 13 05

Videos

Actual Behavior

Screen.Recording.2024-11-22.at.11.15.21.mov

Expected Behavior

Screen.Recording.2024-11-22.at.11.16.44.mov
@MrZyr0
Copy link
Author

MrZyr0 commented Nov 22, 2024

I seem to have this problem on all fields that should open the media gallery.
Below is a video where I have the same problem with a media_gallery field.

Screen.Recording.2024-11-22.at.12.53.00-1.mov

@piterka
Copy link

piterka commented Nov 25, 2024

I have the same problem... @MrZyr0 were you able to fix this somehow?

@MrZyr0
Copy link
Author

MrZyr0 commented Nov 25, 2024

No, for now the only bypass is to change the values in the database.

The block is displayed despite everything, it is really only the opening of the gallery that poses a problem.

@MrZyr0
Copy link
Author

MrZyr0 commented Dec 18, 2024

🆙
Does anyone have any ideas to help me debug this problem?
I have nothing in debug.log, no errors in the console about this. Nothing at all to point me in the right direction.
What's more, I can't reproduce the problem in my local environment.
With the same docker-compose, the same database and the same files, I don't have the problem.

It only seems to exist in my pre-production environment.
What's surprising is that on this same environment, I have two websites built with the same theme (totally ISO, only the content differs) and I've only solved the problem on one of them by deactivating and reactivating my theme and the Yoast SEO plugin. It does nothing on the other site.

I'm totally stuck at this stage

Here's my plugins list :

  • Carbon Fields v3.6.5 (installed with pre-autoloaded package)
  • Redirection v5.5.1
  • WP Mail SMTP v4.3.0
  • WPML Media Translation v2.7.5
  • WPML Multilingual CMS v4.6.15
  • WPML SEO v2.1.0.1
  • WPML String Translation v3.2.17
  • Yoast SEO v24.0

WordPress v6.7.1

@lkuijf
Copy link

lkuijf commented Jan 10, 2025

Setting SCRIPT_DEBUG to false will make the button work.
Credits to alex-l-iwpdev
#1268

@MrZyr0
Copy link
Author

MrZyr0 commented Jan 21, 2025

It change nothing because I enable debugging like this :

define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', false );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

So the SCRIPT_DEBUG is never true

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

No branches or pull requests

3 participants