WP_Interactivity_API::get_router_animation_styles(): string

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 the CSS styles for animating the top loading bar in the router.

Return

string The CSS styles for the router’s top loading bar animation.

Source


/**
 * Processes the `data-wp-context` directive.
 *
 * It adds the context defined in the directive value to the stack so that
 * it's available for the nested interactivity elements.
 *
 * @since 6.5.0
 *
 * @param WP_Interactivity_API_Directives_Processor $p               The directives processor instance.
 * @param string                                    $mode            Whether the processing is entering or exiting the tag.
 */
private function data_wp_context_processor( WP_Interactivity_API_Directives_Processor $p, string $mode ) {
	// When exiting tags, it removes the last context from the stack.
	if ( 'exit' === $mode ) {
		array_pop( $this->context_stack );
		return;
	}

	$attribute_value = $p->get_attribute( 'data-wp-context' );
	$namespace_value = end( $this->namespace_stack );

	// Separates the namespace from the context JSON object.
	list( $namespace_value, $decoded_json ) = is_string( $attribute_value ) && ! empty( $attribute_value )
		? $this->extract_directive_value( $attribute_value, $namespace_value )
		: array( $namespace_value, null );

	/*
	 * If there is a namespace, it adds a new context to the stack merging the
	 * previous context with the new one.
	 */

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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