From 9bd1905b1d8c1883f3531702e7f17ccf84d47c3a Mon Sep 17 00:00:00 2001 From: i-just Date: Thu, 2 Jan 2025 13:39:37 +0000 Subject: [PATCH] let the field be editable even if the cke config was deleted --- src/Field.php | 9 +++++++++ src/templates/_field-settings.twig | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Field.php b/src/Field.php index 35618d3f..22693e04 100644 --- a/src/Field.php +++ b/src/Field.php @@ -621,8 +621,17 @@ public function getSettingsHtml(): ?string ]; } + $ckeConfig = null; + if ($this->ckeConfig) { + try { + $ckeConfig = Plugin::getInstance()->getCkeConfigs()->getByUid($this->ckeConfig); + } catch (InvalidArgumentException) { + } + } + return $view->renderTemplate('ckeditor/_field-settings.twig', [ 'field' => $this, + 'ckeConfig' => $ckeConfig, 'purifierConfigOptions' => $this->configOptions('htmlpurifier'), 'volumeOptions' => $volumeOptions, 'transformOptions' => $transformOptions, diff --git a/src/templates/_field-settings.twig b/src/templates/_field-settings.twig index 219af324..45718648 100644 --- a/src/templates/_field-settings.twig +++ b/src/templates/_field-settings.twig @@ -5,7 +5,7 @@ id: 'cke-config', name: 'ckeConfig', options: plugin('ckeditor').ckeConfigs.getAll(), - value: field.ckeConfig ? plugin('ckeditor').ckeConfigs.getByUid(field.ckeConfig) : null, + value: ckeConfig ?? null, limit: 1, createAction: 'ckeditor/cke-configs/edit', }) }}