From 5bdc21a3fc5894a348ef251fd58a1782db989664 Mon Sep 17 00:00:00 2001 From: bartlomiej Date: Tue, 27 Jun 2023 13:57:16 +0200 Subject: [PATCH] fix: unlock xml edit by fetature flag --- models/classes/xmlEditor/XmlEditor.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/models/classes/xmlEditor/XmlEditor.php b/models/classes/xmlEditor/XmlEditor.php index c7cde1d74..b925a8e19 100644 --- a/models/classes/xmlEditor/XmlEditor.php +++ b/models/classes/xmlEditor/XmlEditor.php @@ -23,12 +23,14 @@ namespace oat\taoQtiTest\models\xmlEditor; use oat\oatbox\service\ConfigurableService; +use oat\tao\model\featureFlag\FeatureFlagChecker; use qtism\data\storage\xml\XmlDocument; use taoQtiTest_models_classes_QtiTestService; use core_kernel_classes_Resource; class XmlEditor extends ConfigurableService implements XmlEditorInterface { + private const XML_EDITOR_ENABLED = 'XML_EDITOR_ENABLED'; /** * {@inheritdoc} */ @@ -54,6 +56,10 @@ public function saveStringTest(core_kernel_classes_Resource $test, string $testS */ public function isLocked(): bool { + if ($this->getFeatureFlagChecker()->isEnabled(self::XML_EDITOR_ENABLED)) { + return false; + } + return $this->hasOption('is_locked') ? (bool)$this->getOption('is_locked') : true; } @@ -61,4 +67,9 @@ private function getTestService(): taoQtiTest_models_classes_QtiTestService { return $this->getServiceLocator()->get(taoQtiTest_models_classes_QtiTestService::class); } + + private function getFeatureFlagChecker(): FeatureFlagChecker + { + return $this->getServiceManager()->getContainer()->get(FeatureFlagChecker::class); + } }