N°3520 - HTML metadata: Add object state in object details if present

This commit is contained in:
Molkobain
2021-09-30 21:30:56 +02:00
parent 9ea25188ba
commit 7d46626d9c
2 changed files with 12 additions and 2 deletions

View File

@@ -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

View File

@@ -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 %}