2021-06-01 07:46:29 +02:00
|
|
|
<?php
|
|
|
|
$randomId = Cake\Utility\Security::randomString(8);
|
|
|
|
if (isset($field['raw'])) {
|
|
|
|
$string = $field['raw'];
|
|
|
|
} else {
|
|
|
|
$value = Cake\Utility\Hash::extract($data, $field['path']);
|
2021-06-28 11:48:39 +02:00
|
|
|
$string = count($value) == 0 ? '' : $value[0];
|
2021-06-01 07:46:29 +02:00
|
|
|
}
|
|
|
|
echo sprintf(
|
|
|
|
'<div class="json_container_%s"></div>',
|
|
|
|
h($randomId)
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.json_container_<?php echo h($randomId);?>').html(syntaxHighlightJson(<?php echo json_encode($string); ?>, 4));
|
|
|
|
});
|
|
|
|
</script>
|