WP_Interactivity_API_Directives_Processor::get_balanced_tag_bookmarks(): array|null

In this article

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.

Returns a pair of bookmarks for the current opener tag and the matching closer tag.

Description

It positions the cursor in the closer tag of the balanced tag, if it exists.

Return

array|null A pair of bookmarks, or null if there’s no matching closing tag.

Source

private function get_balanced_tag_bookmarks() {
	static $i   = 0;
	$opener_tag = 'opener_tag_of_balanced_tag_' . ++$i;

	$this->set_bookmark( $opener_tag );
	if ( ! $this->next_balanced_tag_closer_tag() ) {
		$this->release_bookmark( $opener_tag );
		return null;
	}

	$closer_tag = 'closer_tag_of_balanced_tag_' . ++$i;
	$this->set_bookmark( $closer_tag );

	return array( $opener_tag, $closer_tag );
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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