lila 5 лет назад
Родитель
Сommit
6225ee122c
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/Widgets/Code.php

+ 3 - 1
src/Widgets/Code.php

@@ -18,7 +18,9 @@ class Code extends Markdown
      */
     public function __construct($content = '', int $start = 1, int $end = 10)
     {
-        if (is_file($content)) {
+        if (is_array($content) || is_object($content)) {
+            $content = json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
+        } elseif (is_file($content)) {
             $this->read($content, $start, $end);
             $content = '';
         }