mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
N°6179 - Tooltip attribute in field component (in Twig)
This commit is contained in:
@@ -46,6 +46,8 @@ class Field extends UIContentBlock
|
||||
/** @var string */
|
||||
protected $sLabel;
|
||||
/** @var string */
|
||||
protected $sTooltip = '';
|
||||
/** @var string */
|
||||
protected $sValueId;
|
||||
|
||||
/** @var string */
|
||||
@@ -354,4 +356,28 @@ class Field extends UIContentBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetTooltip(): string
|
||||
{
|
||||
return $this->sTooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sTooltip
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTooltip(string $sTooltip)
|
||||
{
|
||||
$this->sTooltip = $sTooltip;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function HasTooltip() : bool
|
||||
{
|
||||
return $this->GetTooltip() !== '';
|
||||
}
|
||||
}
|
||||
@@ -86,23 +86,26 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oField;
|
||||
}
|
||||
|
||||
public static function MakeLarge(string $sLabel, string $sValueHtml = '')
|
||||
public static function MakeLarge(string $sLabel, string $sValueHtml = '', string $sTooltip = '')
|
||||
{
|
||||
$oField = new Field($sLabel, new Html($sValueHtml));
|
||||
$oField->SetTooltip($sTooltip);
|
||||
$oField->SetLayout(Field::ENUM_FIELD_LAYOUT_LARGE);
|
||||
return $oField;
|
||||
}
|
||||
|
||||
public static function MakeSmall(string $sLabel, string $sValueHtml = '')
|
||||
public static function MakeSmall(string $sLabel, string $sValueHtml = '', string $sTooltip = '')
|
||||
{
|
||||
$oField = new Field($sLabel, new Html($sValueHtml));
|
||||
$oField->SetTooltip($sTooltip);
|
||||
$oField->SetLayout(Field::ENUM_FIELD_LAYOUT_SMALL);
|
||||
return $oField;
|
||||
}
|
||||
|
||||
public static function MakeStandard(string $sLabel = '', string $sLayout = Field::ENUM_FIELD_LAYOUT_SMALL, ?string $sId = null)
|
||||
public static function MakeStandard(string $sLabel = '', string $sLayout = Field::ENUM_FIELD_LAYOUT_SMALL, ?string $sId = null, string $sTooltip = '')
|
||||
{
|
||||
$oField = new Field($sLabel, null, $sId);
|
||||
$oField->SetTooltip($sTooltip);
|
||||
$oField->SetLayout($sLayout);
|
||||
return $oField;
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
{% endif %}
|
||||
>
|
||||
<div class="ibo-field--label">{{ oUIBlock.GetLabel()|raw }}
|
||||
{% if oUIBlock.HasTooltip() %}
|
||||
<span class="ibo-has-description" data-tooltip-content="{{ oUIBlock.GetTooltip() }}" data-tooltip-max-width="600px" ></span>
|
||||
{% endif %}
|
||||
{% if oUIBlock.GetLayout() == constant("Combodo\\iTop\\Application\\UI\\Base\\Component\\Field\\Field::ENUM_FIELD_LAYOUT_LARGE") %}
|
||||
{% if oUIBlock.GetComments() %}
|
||||
<div class="ibo-field--comments">{{ oUIBlock.GetComments()|raw }}</div>
|
||||
|
||||
Reference in New Issue
Block a user