WP_Interactivity_API::data_wp_router_region_processor()privateWP 6.5.0

Processes the data-wp-router-region directive.

It renders in the footer a set of HTML elements to notify users about client-side navigations. More concretely, the elements added are 1) a top loading bar to visually inform that a navigation is in progress and 2) an aria-live region for accessible navigation announcements.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->data_wp_router_region_processor( $p, $mode );
$p(WP_Interactivity_API_Directives_Processor) (обязательный)
The directives processor instance.
$mode(строка) (обязательный)
Whether the processing is entering or exiting the tag.

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

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

Код WP_Interactivity_API::data_wp_router_region_processor() WP 6.7.1

private function data_wp_router_region_processor( WP_Interactivity_API_Directives_Processor $p, string $mode ) {
	if ( 'enter' === $mode && ! $this->has_processed_router_region ) {
		$this->has_processed_router_region = true;

		// Enqueues as an inline style.
		wp_register_style( 'wp-interactivity-router-animations', false );
		wp_add_inline_style( 'wp-interactivity-router-animations', $this->get_router_animation_styles() );
		wp_enqueue_style( 'wp-interactivity-router-animations' );

		// Adds the necessary markup to the footer.
		add_action( 'wp_footer', array( $this, 'print_router_markup' ) );
	}
}