This commit is contained in:
Dennis Eichhorn 2024-01-02 23:34:17 +00:00
parent 95af17ec60
commit b66a28e782
7 changed files with 41 additions and 33 deletions

View File

@ -79,6 +79,15 @@ trait AttributeHolderTrait
return false;
}
/**
* Check if a certain attribute type exists by name
*
* @param string $attrName Attribute name to check
*
* @return bool
*
* @since 1.0.0
*/
public function hasAttributeType(string $attrName) : bool
{
foreach ($this->attributes as $attribute) {

View File

@ -104,9 +104,9 @@ class AttributeValue implements \JsonSerializable
/**
* Localization
*
* @var null|BaseStringL11n
* @var string|BaseStringL11n
*/
public ?BaseStringL11n $l11n = null;
public string | BaseStringL11n $l11n = '';
/**
* Set l11n

View File

@ -17,7 +17,7 @@ namespace Modules\Attribute\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Permision state enum.
* Permission category enum.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0

View File

@ -33,7 +33,7 @@ $l11n = $this->data['defaultlocalization'] ?? new NullLocalization();
data-add-tpl="#attributeTable tbody .oms-add-tpl-attribute">
<div class="portlet-head"><?= $this->getHtml('Attribute', 'Attribute', 'Backend'); ?></div>
<div class="portlet-body">
<input type="hidden" id="iAttributeRef" name="ref" value="<?= $this->refId ?>" disabled>
<input type="hidden" id="iAttributeRef" name="ref" value="<?= $this->refId; ?>" disabled>
<div class="form-group">
<label for="iAttributeId"><?= $this->getHtml('ID', '0', '0'); ?></label>
@ -81,7 +81,7 @@ $l11n = $this->data['defaultlocalization'] ?? new NullLocalization();
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Attributes', 'Attribute', 'Backend'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="attributeTable" class="default"
<table id="attributeTable" class="default sticky"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-attribute"

View File

@ -58,7 +58,7 @@ final class AttributeTypeTest extends \PHPUnit\Framework\TestCase
$type->defaults[] = new AttributeValue();
$type->defaults[0]->setValue(false, AttributeValueType::_BOOL);
self::assertEquals(false, $type->getDefaultByValue(false)->getValue());
self::assertFalse($type->getDefaultByValue(false)->getValue());
}
public function testGetDefaultFloat() : void

View File

@ -16,7 +16,6 @@ namespace Modules\Admin\tests\Models;
use Modules\Attribute\Models\AttributeValue;
use Modules\Attribute\Models\AttributeValueType;
use Modules\Attribute\Models\AttributeValueValue;
/**
* @testdox Modules\Admin\tests\Models\AttributeValueTest: Attribute model
@ -54,7 +53,7 @@ final class AttributeValueTest extends \PHPUnit\Framework\TestCase
$value = new AttributeValue();
$value->setValue(false, AttributeValueType::_BOOL);
self::assertEquals(false, $value->getValue());
self::assertFalse($value->getValue());
}
public function testGetDefaultFloat() : void