AdvancedCustomFields / AdvancedCustomFields/acf

[Feature Request] Block Transform Capability for ACF Blocks

Open
#377 7 comments 4 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 a feature request, I think it would be valuable to have the option to create a link between two blocks that have similar data, this way one could use the Gutenburg "Transform" feature to swap block templates

Example of the paragraph block, which can tranform into a heading, quote, etc:
image

You could explicitly define support in the block registration like so:

acf_register_block_type([
    'name'       => 'my-first-block',
    ...
    'transform   => [ 'acf/my-second-block', ],
 ]);

Alternatively, if you registered block field groups for multiple block locations (or combinator, not and):

'location' => array(
    array(
        array(
            'param' => 'block',
            'operator' => '==',
            'value' => 'acf/my-first-block',
        ),
    ),
    array(
        array(
            'param' => 'block',
            'operator' => '==',
            'value' => 'acf/my-second-block',
        ),
    ),
),

You could ensure that the two blocks contain the same data, and thus would be compatible.

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 reviewing the acf_register_block_type API and Gutenberg's Transform feature described in the issue. Determine how compatible ACF blocks should declare or derive transforms, and define completion around two registered blocks being able to swap templates while preserving their shared data.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.