mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
PR fix
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
{% 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>
|
||||
{% if oUIBlock.HasDescription() %}
|
||||
<span class="ibo-has-description" data-tooltip-content="{{ oUIBlock.GetDescription() }}" 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() %}
|
||||
|
||||
Reference in New Issue
Block a user