WP_Interactivity_API::config()publicWP 6.5.0

Gets and/or sets the configuration of the Interactivity API for a given store namespace.

If configuration for that store namespace exists, it merges the new provided configuration with the existing one.

Method of the class: WP_Interactivity_API{}

No Hooks.

Return

Array. The configuration for the specified store namespace. This will be the updated configuration if a $config argument was provided.

Usage

$WP_Interactivity_API = new WP_Interactivity_API();
$WP_Interactivity_API->config( $store_namespace, $config ): array;
$store_namespace(string) (required)
The unique store namespace identifier.
$config(array)
The array that will be merged with the existing configuration for the specified store namespace.
Default: array()

Changelog

Since 6.5.0 Introduced.

WP_Interactivity_API::config() code WP 6.7.1

public function config( string $store_namespace, array $config = array() ): array {
	if ( ! isset( $this->config_data[ $store_namespace ] ) ) {
		$this->config_data[ $store_namespace ] = array();
	}
	if ( is_array( $config ) ) {
		$this->config_data[ $store_namespace ] = array_replace_recursive(
			$this->config_data[ $store_namespace ],
			$config
		);
	}
	return $this->config_data[ $store_namespace ];
}