Automattic\WooCommerce\EmailEditor\Engine

Personalizer::get_callback_context │ private │ WC 1.0

Build the context array passed to a tag callback, exposing the rendering context of the current replacement site under the reserved key.

Method of the class: Personalizer{}

No Hooks.

Returns

array<string, mixed>. The callback context.

Usage

// private - for code of main (parent) class only
$result = $this->get_callback_context( $rendering_context ): array;
$rendering_context(string) (required)
One of the RENDERING_CONTEXT_* constants.

Personalizer::get_callback_context() code WC 11.1.2

private function get_callback_context( string $rendering_context ): array {
	// array_replace() (unlike array_merge()) preserves integer keys in the consumer's context.
	return array_replace( $this->context, array( self::RENDERING_CONTEXT_KEY => $rendering_context ) );
}