diff --git a/sources/application/UI/Base/Component/Field/Field.php b/sources/application/UI/Base/Component/Field/Field.php index d76382651..5ffac7868 100644 --- a/sources/application/UI/Base/Component/Field/Field.php +++ b/sources/application/UI/Base/Component/Field/Field.php @@ -9,6 +9,7 @@ namespace Combodo\iTop\Application\UI\Base\Component\Field; use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock; use Combodo\iTop\Application\UI\Base\UIBlock; +use utils; /** * @since 3.0.0 @@ -45,8 +46,11 @@ class Field extends UIContentBlock protected $sValueRaw; /** @var string */ protected $sLabel; - /** @var string */ - protected $sTooltip = ''; + /** + * @var string + * @since 3.1.0 + */ + protected $sDescription = ''; /** @var string */ protected $sValueId; @@ -359,25 +363,31 @@ class Field extends UIContentBlock /** * @return string + * @since 3.1.0 */ - public function GetTooltip(): string + public function GetDescription(): string { - return $this->sTooltip; + return $this->sDescription; } /** - * @param string $sTooltip + * @param string $sDescription * * @return $this + * @since 3.1.0 */ - public function SetTooltip(string $sTooltip) + public function SetDescription(string $sDescription) { - $this->sTooltip = $sTooltip; + $this->sDescription = $sDescription; return $this; } - public function HasTooltip() : bool + /* + * @return bool + * @since 3.1.0 + */ + public function HasDescription(): bool { - return $this->GetTooltip() !== ''; + return utils::IsNotNullOrEmptyString($this->GetDescription()); } } \ No newline at end of file diff --git a/sources/application/UI/Base/Component/Field/FieldUIBlockFactory.php b/sources/application/UI/Base/Component/Field/FieldUIBlockFactory.php index 2d64cc694..c2ee3fe7f 100644 --- a/sources/application/UI/Base/Component/Field/FieldUIBlockFactory.php +++ b/sources/application/UI/Base/Component/Field/FieldUIBlockFactory.php @@ -90,14 +90,14 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory * @api * @param string $sLabel * @param string $sValueHtml - * @param string $sTooltip + * @param string $sDescription * * @return \Combodo\iTop\Application\UI\Base\Component\Field\Field */ - public static function MakeLarge(string $sLabel, string $sValueHtml = '', string $sTooltip = '') + public static function MakeLarge(string $sLabel, string $sValueHtml = '', string $sDescription = '') { $oField = new Field($sLabel, new Html($sValueHtml)); - $oField->SetTooltip($sTooltip); + $oField->SetDescription($sDescription); $oField->SetLayout(Field::ENUM_FIELD_LAYOUT_LARGE); return $oField; } @@ -106,14 +106,14 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory * @api * @param string $sLabel * @param string $sValueHtml - * @param string $sTooltip + * @param string $sDescription * * @return \Combodo\iTop\Application\UI\Base\Component\Field\Field */ - public static function MakeSmall(string $sLabel, string $sValueHtml = '', string $sTooltip = '') + public static function MakeSmall(string $sLabel, string $sValueHtml = '', string $sDescription = '') { $oField = new Field($sLabel, new Html($sValueHtml)); - $oField->SetTooltip($sTooltip); + $oField->SetDescription($sDescription); $oField->SetLayout(Field::ENUM_FIELD_LAYOUT_SMALL); return $oField; } @@ -123,14 +123,14 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory * @param string $sLabel * @param string $sLayout * @param string|null $sId - * @param string $sTooltip + * @param string $sDescription * * @return \Combodo\iTop\Application\UI\Base\Component\Field\Field */ - public static function MakeStandard(string $sLabel = '', string $sLayout = Field::ENUM_FIELD_LAYOUT_SMALL, ?string $sId = null, string $sTooltip = '') + public static function MakeStandard(string $sLabel = '', string $sLayout = Field::ENUM_FIELD_LAYOUT_SMALL, ?string $sId = null, string $sDescription = '') { $oField = new Field($sLabel, null, $sId); - $oField->SetTooltip($sTooltip); + $oField->SetDescription($sDescription); $oField->SetLayout($sLayout); return $oField; diff --git a/templates/base/components/field/layout.html.twig b/templates/base/components/field/layout.html.twig index 4f582bfeb..fb7a858f6 100644 --- a/templates/base/components/field/layout.html.twig +++ b/templates/base/components/field/layout.html.twig @@ -23,8 +23,8 @@ {% endif %} >
{{ oUIBlock.GetLabel()|raw }} - {% if oUIBlock.HasTooltip() %} - + {% if oUIBlock.HasDescription() %} + {% endif %} {% if oUIBlock.GetLayout() == constant("Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\Field::ENUM_FIELD_LAYOUT_LARGE") %} {% if oUIBlock.GetComments() %}