diff --git a/actions/class.Tests.php b/actions/class.Tests.php
index ae16242d..4be865c6 100755
--- a/actions/class.Tests.php
+++ b/actions/class.Tests.php
@@ -32,6 +32,7 @@
use oat\tao\model\controller\SignedFormInstance;
use oat\tao\model\resources\Service\ClassDeleter;
use oat\tao\model\routing\AnnotationReader\security;
+use oat\taoTests\models\Form\Modifier\FormModifierProxy;
use oat\taoTests\models\Translation\Form\Modifier\TranslationFormModifierProxy;
use tao_helpers_form_FormContainer as FormContainer;
use oat\generis\model\resource\Service\ResourceDeleter;
@@ -116,6 +117,7 @@ public function editTest()
],
],
FormContainer::FORM_MODIFIERS => [
+ FormModifierProxy::class,
TranslationFormModifierProxy::class,
],
]
diff --git a/manifest.php b/manifest.php
index e0c30ad9..9813496e 100755
--- a/manifest.php
+++ b/manifest.php
@@ -32,6 +32,7 @@
use oat\tao\model\accessControl\func\AccessRule;
use oat\tao\model\user\TaoRoles;
use oat\taoTests\models\Copier\CopierServiceProvider;
+use oat\taoTests\models\Form\ServiceProvider\FormServiceProvider;
use oat\taoTests\models\Translation\ServiceProvider\TranslationServiceProvider;
use oat\taoTests\models\user\TaoTestsRoles;
use oat\taoTests\scripts\install\RegisterFrontendPaths;
@@ -134,5 +135,6 @@
'containerServiceProviders' => [
CopierServiceProvider::class,
TranslationServiceProvider::class,
+ FormServiceProvider::class,
],
];
diff --git a/models/classes/Form/Modifier/FormModifierProxy.php b/models/classes/Form/Modifier/FormModifierProxy.php
new file mode 100644
index 00000000..a6ee981c
--- /dev/null
+++ b/models/classes/Form/Modifier/FormModifierProxy.php
@@ -0,0 +1,29 @@
+services();
+
+ $services
+ ->set(FormModifierProxy::class, FormModifierProxy::class)
+ ->public();
+
+ $services
+ ->get(FormModifierProxy::class)
+ ->call(
+ 'addModifier',
+ [
+ service(UniqueIdFormModifier::class),
+ ]
+ );
+ }
+}
diff --git a/models/classes/Translation/Form/Modifier/TranslationFormModifier.php b/models/classes/Translation/Form/Modifier/TranslationFormModifier.php
index de393c81..502042c3 100644
--- a/models/classes/Translation/Form/Modifier/TranslationFormModifier.php
+++ b/models/classes/Translation/Form/Modifier/TranslationFormModifier.php
@@ -22,6 +22,7 @@
namespace oat\taoTests\models\Translation\Form\Modifier;
+use oat\generis\model\data\Ontology;
use oat\tao\model\featureFlag\FeatureFlagCheckerInterface;
use oat\tao\model\form\Modifier\AbstractFormModifier;
use oat\tao\model\TaoOntology;
@@ -32,10 +33,12 @@
class TranslationFormModifier extends AbstractFormModifier
{
private FeatureFlagCheckerInterface $featureFlagChecker;
+ private Ontology $ontology;
- public function __construct(FeatureFlagCheckerInterface $featureFlagChecker)
+ public function __construct(FeatureFlagCheckerInterface $featureFlagChecker, Ontology $ontology)
{
$this->featureFlagChecker = $featureFlagChecker;
+ $this->ontology = $ontology;
}
public function modify(Form $form, array $options = []): void
@@ -44,11 +47,15 @@ public function modify(Form $form, array $options = []): void
$form->removeElement(tao_helpers_Uri::encode(TaoTestOntology::PROPERTY_TRANSLATION_COMPLETION));
}
- $translationTypeValue = $form->getValue(tao_helpers_Uri::encode(TaoOntology::PROPERTY_TRANSLATION_TYPE));
+ $instance = $this->ontology->getResource($form->getValue('uri'));
+
+ $translationType = $instance->getOnePropertyValue(
+ $this->ontology->getProperty(TaoOntology::PROPERTY_TRANSLATION_TYPE)
+ );
if (
- empty($translationTypeValue)
- || $translationTypeValue === TaoOntology::PROPERTY_VALUE_TRANSLATION_TYPE_ORIGINAL
+ empty($translationType)
+ || $translationType->getUri() === TaoOntology::PROPERTY_VALUE_TRANSLATION_TYPE_ORIGINAL
) {
$form->removeElement(tao_helpers_Uri::encode(TaoTestOntology::PROPERTY_TRANSLATION_COMPLETION));
}
diff --git a/models/classes/Translation/ServiceProvider/TranslationServiceProvider.php b/models/classes/Translation/ServiceProvider/TranslationServiceProvider.php
index 47409cce..2c1320a3 100644
--- a/models/classes/Translation/ServiceProvider/TranslationServiceProvider.php
+++ b/models/classes/Translation/ServiceProvider/TranslationServiceProvider.php
@@ -63,6 +63,7 @@ public function __invoke(ContainerConfigurator $configurator): void
->set(TranslationFormModifier::class, TranslationFormModifier::class)
->args([
service(FeatureFlagChecker::class),
+ service(Ontology::SERVICE_ID),
]);
$services
diff --git a/models/ontology/taotest.rdf b/models/ontology/taotest.rdf
index 9cd34e62..36aad553 100644
--- a/models/ontology/taotest.rdf
+++ b/models/ontology/taotest.rdf
@@ -117,9 +117,6 @@
-
-
-
@@ -133,7 +130,7 @@
-
+