WP_Interactivity_API_Directives_Processor::get_balanced_tag_bookmarks()privateWP 6.5.0

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

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

Метод класса: WP_Interactivity_API_Directives_Processor{}

Хуков нет.

Возвращает

Массив|null. A pair of bookmarks, or null if there's no matching closing tag.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_balanced_tag_bookmarks();

Список изменений

С версии 6.5.0 Введена.

Код WP_Interactivity_API_Directives_Processor::get_balanced_tag_bookmarks() WP 6.7.1

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 );
}