AdvancedCustomFields / AdvancedCustomFields/acf

Editor block becomes blank when switching styles in edit mode (ACF 5.8.1)

Open
#197 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

As stated in the title, when I'm in edit mode with form inputs, trying to switch between custom block styles, the content of the block disappears.

I'm using the latest Safari on MacOS.

The code:

/**
 * Test ACF blocks in 5.8
 */

function my_acf_block_render_callback() {
	$settings = get_field( 'my-settings' );
	echo 'Field stores: ' . var_dump( $settings['url'] );
}

add_action( 'acf/init', 'my_acf_blocks_init' );
function my_acf_blocks_init() {
	/**
	 * Register block
	 */
	acf_register_block_type( array(
		'name'            => 'my',
		'title'           => __( 'My Test Block', 'my-acf' ),
		'description'     => __( 'A block for entering a link name and a custom URL.', 'my-acf' ),
		'render_callback' => 'my_acf_block_render_callback',
		'category'        => 'formatting',
		'icon'            => 'external',
		'keywords'        => array(),
		'supports'        => array( 'align' => false ),
		'mode'            => 'edit',
		'styles'          => array(
			array( 'name' => 'normal', 'label' => __( 'Normal', 'my-acf' ), 'isDefault' => true ),
			array( 'name' => 'fancy', 'label' => __( 'Fancy', 'my-acf' ) ),
		),
	) );

	/**
	 * Define block fields
	 */
	acf_add_local_field_group( array(
		'key' => "group_my",
		'title' => __( 'Block :: My Test Block', 'my-acf' ),
		'location' => array(
			array(
				array(
					'param' => 'block',
					'operator' => '==',
					'value' => 'acf/my',
				),
			),
		),
		'fields' => array(
			array(
				'key' => "field_my-settings",
				'label' => false,
				'name' => "my-settings",
				'type' => 'group',
				'layout' => 'block',
				'sub_fields' => array(
					array(
						'key' => "field_my-settings-url",
						'label' => __( 'URL', 'sai-acf' ),
						'name' => 'url',
						'type' => 'url',
						'placeholder' => 'https://',
					),
				),
			), // EOF settings
		),
	) );
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Safari on macOS using the provided ACF 5.8.1 block registration, edit-mode form fields, and Normal/Fancy styles. Trace the block editor behavior when switching styles; done means the block content and form inputs remain visible after changing styles.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.