AdvancedCustomFields / AdvancedCustomFields/acf

Locking InnerBlocks Template

Open
#365 5 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

I am trying to create a parent-child block in ACF by using InnerBlocks. The behavior I want is to lock the parent with some templates in the inner blocks like:


$template = [
	[
		"acf/acfb-my-child-block",
		[]
	],
	[
		"acf/acfb-my-child-block",
		[]
	]
];

<InnerBlocks templateLock="all" template="<?php echo esc_attr( wp_json_encode( $template ) ) ?>" />

Now user can insert more blocks from the child block like:

	$template = [
		[
			'core/paragraph',
			[]	
		]
	];

<InnerBlocks  template="<?php echo esc_attr( wp_json_encode( $template ) ) ?>" />

But due to the templateLock="all" applied on the parent block the child block can't insert new blocks. After some research, I've found that maybe templateLock="false" on child block can fix the issue but this InnerBlocks functionality is not available in ACF?

Any solution, suggestions will be much appreciated!

Thanks

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 with the PHP reproduction in the issue and inspect ACF's InnerBlocks support alongside WordPress's parent and child templateLock behavior. Determine whether nested blocks can override the parent's lock, then define the relevant implementation or documentation change and verify it with a focused reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.