Automattic\WooCommerce\Internal\Admin\BlockTemplates

BlockTemplateLogger::add_template_eventprivateWC 1.0

Add a template event.

Method of the class: BlockTemplateLogger{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->add_template_event( $event_type_info, $template, $container, $block, $additional_info );
$event_type_info(array) (required)
Event type info.
$template(BlockTemplateInterface) (required)
Template.
$container(ContainerInterface) (required)
Container.
$block(BlockInterface) (required)
Block.
$additional_info(array)
Additional info.
Default: array()

BlockTemplateLogger::add_template_event() code WC 10.7.0

private function add_template_event( array $event_type_info, BlockTemplateInterface $template, ContainerInterface $container, BlockInterface $block, array $additional_info = array() ) {
	$template_id = $template->get_id();

	if ( ! isset( $this->all_template_events[ $template_id ] ) ) {
		$this->all_template_events[ $template_id ] = array();
		$this->templates[ $template_id ]           = $template;
	}

	$template_events = &$this->all_template_events[ $template_id ];

	$template_events[] = array(
		'level'           => $event_type_info['level'],
		'event_type'      => $event_type_info['event_type'],
		'message'         => $event_type_info['message'],
		'container'       => $container,
		'block'           => $block,
		'additional_info' => $additional_info,
	);
}