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

WP 6.7.1 define( 'SCRIPT_DEBUG', true ) image, file fields do not work #1268

Open
alex-l-iwpdev opened this issue Nov 28, 2024 · 0 comments
Open

Comments

@alex-l-iwpdev
Copy link

Version

  • Carbon Fields: ^3.6
  • WordPress: 6.7.1
  • PHP: 8.0-dev-4.22.2

Expected Behavior

open the popup to select a file or upload a file

Actual Behavior

when I click nothing happens, and when the page loads there are several JS errors, while deleting the image works but I can no longer add an image

Container definition

Block::make( __( 'Main menu in home page', 'jakekrantz' ) )
			->set_category( 'jakekrantz', __( 'JakekRantz', 'jakekrantz' ) )
			->set_icon( 'menu-alt3' )
			->add_fields(
				[
					Field::make( 'image', 'image', __( 'Background image', 'jakekrantz' ) ),
					Field::make( 'complex', 'menu_items', __( 'Menu items', 'jakekrantz' ) )
						->add_fields(
							[
								Field::make( 'text', 'title', __( 'Item title', 'jakekrantz' ) )->set_width( 50 ),
								Field::make(
									'radio',
									'item_type',
									__( 'Item type', 'jakekrantz' )
								)->add_options(
									[
										'link' => __( 'Link', 'jakekrantz' ),
										'post' => __( 'Post', 'jakekrantz' ),
										'file' => __( 'File', 'jakekrantz' ),
									]
								)->set_default_value( 'link' ),
								Field::make( 'association', 'page_link', __( 'Page link', 'jakekrantz' ) )
									->set_types(
										[
											[
												'type'      => 'post',
												'post_type' => 'page',
											],
										]
									)->set_max( 1 )->set_width( 50 )
									->set_conditional_logic(
										[
											'relation' => 'AND',
											[
												'field'   => 'item_type',
												'value'   => 'post',
												'compare' => '=',
											],
										]
									),
								Field::make(
									'text',
									'link',
									__( 'Link', 'jakekrantz' )
								)->set_conditional_logic(
									[
										'relation' => 'AND',
										[
											'field'   => 'item_type',
											'value'   => 'link',
											'compare' => '=',
										],
									]
								),
								Field::make(
									'file',
									'file_to_pop_up',
									__( 'File', 'jakekrantz' )
								)->set_conditional_logic(
									[
										'relation' => 'AND',
										[
											'field'   => 'item_type',
											'value'   => 'file',
											'compare' => '=',
										],
									]
								),
								Field::make( 'image', 'item_icon', __( 'Item icon', 'jakekrantz' ) )->set_width( 50 ),
								Field::make( 'text', 'icon_class', __( 'Icon class', 'jakekrantz' ) )->set_width( 50 ),
							]
						),
				]
			)
			->set_render_callback(
				function ( $fields, $attributes ) {
					get_template_part(
						'template-parts/blocks/block',
						'main-menu',
						[
							'fields'     => $fields,
							'attributes' => $attributes,
						]
					);
				}
			);

Steps to Reproduce the Problem

  1. upload image
  2. Change image

Comments

jakekrantz.docker.localhost-1732787286132.log

If you set SCRIPT_DEBUG to false everything works

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

1 participant