diff --git a/src/Panel/Model.php b/src/Panel/Model.php index 707e2f1a5f..482fb222b1 100644 --- a/src/Panel/Model.php +++ b/src/Panel/Model.php @@ -37,7 +37,19 @@ abstract public function buttons(): array; */ public function content(): array { - return Form::for($this->model)->values(); + $version = $this->model->version('changes'); + $changes = []; + + if ($version->exists() === true) { + $changes = $version->content()->toArray(); + } + + return Form::for( + model: $this->model, + props: [ + 'values' => $changes + ] + )->values(); } /** diff --git a/src/Panel/Page.php b/src/Panel/Page.php index 59b8926ad0..1f92d007ef 100644 --- a/src/Panel/Page.php +++ b/src/Panel/Page.php @@ -4,7 +4,6 @@ use Kirby\Cms\File as CmsFile; use Kirby\Cms\ModelWithContent; -use Kirby\Content\VersionId; use Kirby\Filesystem\Asset; use Kirby\Panel\Ui\Buttons\ViewButtons; use Kirby\Toolkit\I18n; @@ -372,25 +371,11 @@ public function props(): array */ public function view(): array { - $page = $this->model; - - // This is placed here as a proof of concept - // @todo we need to find a better place for it - // to switch into changes mode in the panel - VersionId::$render = VersionId::changes(); - - $view = [ - 'breadcrumb' => $page->panel()->breadcrumb(), + return [ + 'breadcrumb' => $this->model->panel()->breadcrumb(), 'component' => 'k-page-view', 'props' => $this->props(), - 'title' => $page->title()->toString(), + 'title' => $this->model->title()->toString(), ]; - - // The render mode needs to be undone here to keep unit tests working - // That's the downside of such static properties. They are likely to - // cause side-effects - VersionId::$render = null; - - return $view; } }