diff --git a/sources/application/UI/Base/Layout/Object/ObjectDetails.php b/sources/application/UI/Base/Layout/Object/ObjectDetails.php index 973d99b5cd..78ab128e8c 100644 --- a/sources/application/UI/Base/Layout/Object/ObjectDetails.php +++ b/sources/application/UI/Base/Layout/Object/ObjectDetails.php @@ -61,9 +61,9 @@ class ObjectDetails extends Panel implements iKeyboardShortcut protected $sIconUrl; /** @var string|null Code of the current value of the attribute carrying the state for $sClassName */ protected $sStatusCode; - /** @var string Label of the current value of the attribute carrying the state for $sClassName */ + /** @var string|null Label of the current value of the attribute carrying the state for $sClassName */ protected $sStatusLabel; - /** @var string Color value (eg. #ABCDEF, var(--foo-color), ...) */ + /** @var string|null Color value (eg. #ABCDEF, var(--foo-color), ...) */ protected $sStatusColor; /** @@ -166,6 +166,15 @@ class ObjectDetails extends Panel implements iKeyboardShortcut return $this->sStatusCode; } + /** + * @see static::$sStatusCode + * @return bool + */ + public function HasStatus(): bool + { + return $this->sStatusCode !== null; + } + /** * @see self::$sStatusLabel * @return string diff --git a/templates/base/layouts/object/object-details/layout.html.twig b/templates/base/layouts/object/object-details/layout.html.twig index c07a4af8c2..1ebbb79af8 100644 --- a/templates/base/layouts/object/object-details/layout.html.twig +++ b/templates/base/layouts/object/object-details/layout.html.twig @@ -6,6 +6,7 @@ data-object-class="{{ oUIBlock.GetClassName() }}" data-object-id="{{ oUIBlock.GetObjectId() }}" data-object-mode="{{ oUIBlock.GetObjectMode() }}" + {% if oUIBlock.HasStatus() %}data-object-state="{{ oUIBlock.GetStatusCode() }}"{% endif %} data-role="ibo-object-details" {% endblock %}