From 8fae14a103abab23abfc74e5d4672697e9e710d9 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 12 Jan 2024 00:30:03 +0000 Subject: [PATCH] continue implementations --- Admin/Install/db.json | 5 +++++ Controller/ApiAttributeTraitController.php | 1 + Models/AttributeType.php | 2 ++ Models/AttributeValueMapper.php | 1 + Theme/Backend/Components/attributes.tpl.php | 4 ---- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 41bce14..ba3f6de 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -35,6 +35,11 @@ "type": "TINYINT(1)", "null": false }, + "attribute_attr_type_repeatable": { + "name": "attribute_attr_type_repeatable", + "type": "TINYINT(1)", + "null": false + }, "attribute_attr_type_required": { "description": "Every element must have this attribute type if set to true.", "name": "attribute_attr_type_required", diff --git a/Controller/ApiAttributeTraitController.php b/Controller/ApiAttributeTraitController.php index b75bfc2..4e2ce61 100644 --- a/Controller/ApiAttributeTraitController.php +++ b/Controller/ApiAttributeTraitController.php @@ -154,6 +154,7 @@ trait ApiAttributeTraitController $attrType = new AttributeType($request->getDataString('name') ?? ''); $attrType->datatype = $request->getDataInt('datatype') ?? 0; $attrType->custom = $request->getDataBool('custom') ?? false; + $attrType->repeatable = $request->getDataBool('repeatable') ?? false; $attrType->isRequired = $request->getDataBool('is_required') ?? false; $attrType->validationPattern = $request->getDataString('validation_pattern') ?? ''; $attrType->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); diff --git a/Models/AttributeType.php b/Models/AttributeType.php index 32e85c0..08b2601 100755 --- a/Models/AttributeType.php +++ b/Models/AttributeType.php @@ -63,6 +63,8 @@ class AttributeType implements \JsonSerializable public bool $isRequired = false; + public bool $repeatable = false; + /** * Datatype of the attribute * diff --git a/Models/AttributeValueMapper.php b/Models/AttributeValueMapper.php index 749a8b4..76f7ddb 100755 --- a/Models/AttributeValueMapper.php +++ b/Models/AttributeValueMapper.php @@ -58,6 +58,7 @@ final class AttributeValueMapper extends DataMapperFactory 'mapper' => AttributeValueL11nMapper::class, 'table' => 'attribute_attr_value_l11n', 'self' => 'attribute_attr_value_l11n_value', + 'column' => 'content', 'external' => null, ], ]; diff --git a/Theme/Backend/Components/attributes.tpl.php b/Theme/Backend/Components/attributes.tpl.php index d80cae8..3b77740 100644 --- a/Theme/Backend/Components/attributes.tpl.php +++ b/Theme/Backend/Components/attributes.tpl.php @@ -13,16 +13,12 @@ declare(strict_types=1); use phpOMS\Localization\ISO639Enum; -use phpOMS\Localization\NullLocalization; use phpOMS\Uri\UriFactory; $attribute = $this->attributes; $languages = ISO639Enum::getConstants(); $types = $this->attributeTypes; $units = $this->units; - -/** @var \phpOMS\Localization\Localization $l11n */ -$l11n = $this->data['defaultlocalization'] ?? new NullLocalization(); ?>