Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Forms_Dynamic_Fields::remove_inner_block_from_inner_content( int $inner_block_index, array $parent )

Remove inner block reference from inner content


Description Description

See WP_Block::inner_content documentation.

The inner_content block’s property is an array of string fragments and null markers where inner blocks were found. So here we cycle over the block’s parent innerContent field looking for references to innerBlocks (null). When we found a positional correspondance between the removed innerBlock and its refernce in innerContent we remove the latter too.


Top ↑

Parameters Parameters

$inner_block_index

(int) (Required) The index of the inner block in the block's innerBlocks list.

$parent

(array) (Required) Parsed WP_Block array representing the inner blocks parent. Passed by reference.


Top ↑

Source Source

File: includes/forms/class-llms-forms-dynamic-fields.php

	private function remove_inner_block_from_inner_content( $inner_block_index, &$parent ) {

		$inner_block_in_content_index = 0;
		foreach ( $parent['innerContent'] as $chunk_index => $chunk ) {
			if ( ! is_string( $chunk ) && $inner_block_index === $inner_block_in_content_index++ ) {
				array_splice( $parent['innerContent'], $chunk_index, 1 ); // Remove and re-index.
				break;
			}
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.