Automattic\WooCommerce\Internal\Admin\BlockTemplates
BlockTemplateLogger::to_json
Get all template events as a JSON like array.
Метод класса: BlockTemplateLogger{}
Хуков нет.
Возвращает
Массив. The JSON.
Использование
// private - только в коде основоного (родительского) класса $result = $this->to_json( $template_events ): array;
- $template_events(массив) (обязательный)
- Template events.
Код BlockTemplateLogger::to_json() BlockTemplateLogger::to json WC 10.7.0
private function to_json( array $template_events ): array {
$json = array();
foreach ( $template_events as $template_event ) {
$container = $template_event['container'];
$block = $template_event['block'];
$json[] = array(
'level' => $template_event['level'],
'event_type' => $template_event['event_type'],
'message' => $template_event['message'],
'container' => $container instanceof BlockInterface
? array(
'id' => $container->get_id(),
'name' => $container->get_name(),
)
: null,
'block' => array(
'id' => $block->get_id(),
'name' => $block->get_name(),
),
'additional_info' => $this->format_info( $template_event['additional_info'] ),
);
}
return $json;
}