/** * @inheritdoc */ public function format($record) { try { $data = Json::decode($record->content); } catch (InvalidParamException $e) { return $this->warn($e) . parent::format($record); } $content = Json::encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); return Html::tag('pre', Html::tag('code', Html::encode($content), ['id' => 'response-content', 'class' => 'json'])); }
/** * @inheritdoc */ public function format($record) { $dom = new \DOMDocument(); $dom->formatOutput = true; try { $dom->loadXML($record->content); } catch (ErrorException $e) { return $this->warn($e) . parent::format($record); } $content = $dom->saveXML(); return Html::tag('pre', Html::tag('code', Html::encode($content), ['id' => 'response-content', 'class' => 'xml'])); }
/** * @inheritdoc */ public function format($record, $view) { try { $data = Json::decode($record->content); } catch (InvalidParamException $e) { return parent::format($record, $view); } $content = Json::encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); HighlightAsset::register($view); $view->registerJs('hljs.highlightBlock(document.getElementById("response-content"));'); $view->registerCss('pre code.hljs {background: transparent}'); return Html::tag('pre', Html::tag('code', Html::encode($content), ['id' => 'response-content', 'class' => 'json'])); }
/** * @inheritdoc */ public function format($record, $view) { $dom = new \DOMDocument(); $dom->formatOutput = true; try { $dom->loadXML($record->content); } catch (ErrorException $e) { return parent::format($record, $view); } $content = $dom->saveXML(); HighlightAsset::register($view); $view->registerJs('hljs.highlightBlock(document.getElementById("response-content"));'); $view->registerCss('pre code.hljs {background: transparent}'); return Html::tag('pre', Html::tag('code', Html::encode($content), ['id' => 'response-content', 'class' => 'xml'])); }