AdvancedCustomFields / AdvancedCustomFields/acf

Gutenberg block with clone field doesn't show default value

Open
#530 1 comment 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

When I add a block in the Gutenberg editor that contains a "clone" field, its value is shown only when I change something in any field.

ACF Group fields:

  1. section_appearance (group), subfields:
  • background (select, defalut: "white")
  • bottom_border (true/false, default: false)
  1. section, fields:
  • appearance (clone of the "section_appearance", display: Seamless)

Template added with the acf_register_block function:

echo "appearance:\n";
print_r(get_field('appearance'));
echo "section_appearance:\n";
print_r(get_field('section_appearance'));
?>

What I see after adding a block in the editor:

appearance:
section_appearance:
Array
(
    [field_60fe956ea9e15] => white
    [field_60fe95cda9e16] => 0
)

What I see when I change something in any input and after block view is refreshed:

appearance:
Array
(
    [section_appearance] => Array
        (
            [background] => white
            [bottom_border] => 
        )

)
section_appearance:
Array
(
    [background] => white
    [bottom_border] => 
)

Versions:
WP 5.7.2
ACF Pro 5.9.8

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

Start by reproducing the issue with the acf_register_block template and the listed ACF Group, clone, select, and true/false fields on WordPress 5.7.2 with ACF Pro 5.9.8. Compare the initial block render with the render after changing an input; done means the clone field returns and displays its default values immediately after the block is added.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.