WP_Interactivity_API::data_wp_router_region_processor( WP_Interactivity_API_Directives_Processor $p, string $mode )

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.

Processes the data-wp-router-region directive.

Description

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.

Parameters

$pWP_Interactivity_API_Directives_Processorrequired
The directives processor instance.
$modestringrequired
Whether the processing is entering or exiting the tag.

Source

			$directive_attribute_value = $p->get_attribute( $attribute_name );
			$style_property_value      = $this->evaluate( $directive_attribute_value );
			$style_attribute_value     = $p->get_attribute( 'style' );
			$style_attribute_value     = ( $style_attribute_value && ! is_bool( $style_attribute_value ) ) ? $style_attribute_value : '';

			/*
			 * Checks first if the style property is not falsy and the style
			 * attribute value is not empty because if it is, it doesn't need to
			 * update the attribute value.
			 */
			if ( $style_property_value || $style_attribute_value ) {
				$style_attribute_value = $this->merge_style_property( $style_attribute_value, $style_property, $style_property_value );
				/*
				 * If the style attribute value is not empty, it sets it. Otherwise,
				 * it removes it.
				 */
				if ( ! empty( $style_attribute_value ) ) {
					$p->set_attribute( 'style', $style_attribute_value );
				} else {
					$p->remove_attribute( 'style' );
				}
			}
		}
	}
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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