mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°5920 - Add linkset's description as corresponding tab's tooltip in object details
This commit is contained in:
@@ -77,10 +77,13 @@ class AjaxTab extends Tab
|
||||
* @param string $sTabCode
|
||||
* @param string $sTitle
|
||||
* @param string $sPlaceholderRelPath
|
||||
* @param string|null $sDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
|
||||
*
|
||||
* @since 3.1.0 N°5920 Add $sDescription argument
|
||||
*/
|
||||
public function __construct(string $sTabCode, string $sTitle, string $sPlaceholderRelPath = AjaxTab::DEFAULT_TAB_PLACEHOLDER)
|
||||
public function __construct(string $sTabCode, string $sTitle, string $sPlaceholderRelPath = AjaxTab::DEFAULT_TAB_PLACEHOLDER, ?string $sDescription = null)
|
||||
{
|
||||
parent::__construct($sTabCode, $sTitle);
|
||||
parent::__construct($sTabCode, $sTitle, $sDescription);
|
||||
$this->sPlaceholderRelPath = $sPlaceholderRelPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab;
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use TabManager;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Class Tab
|
||||
@@ -41,17 +42,26 @@ class Tab extends UIContentBlock
|
||||
|
||||
/** @var string */
|
||||
protected $sTitle;
|
||||
/**
|
||||
* @var string|null Text description of the tab and its content, will be used to display hint to the user
|
||||
* @since 3.1.0 N°5920
|
||||
*/
|
||||
protected ?string $sDescription;
|
||||
|
||||
/**
|
||||
* Tab constructor.
|
||||
*
|
||||
* @param string $sTabCode
|
||||
* @param string $sTitle
|
||||
* @param string|null $sDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
|
||||
*
|
||||
* @since 3.1.0 N°5920 Add $sDescription argument
|
||||
*/
|
||||
public function __construct(string $sTabCode, string $sTitle)
|
||||
public function __construct(string $sTabCode, string $sTitle, ?string $sDescription = null)
|
||||
{
|
||||
parent::__construct($sTabCode);
|
||||
$this->sTitle = $sTitle;
|
||||
$this->sDescription = $sDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +80,35 @@ class Tab extends UIContentBlock
|
||||
return $this->sTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function GetDescription(): ?string
|
||||
{
|
||||
return $this->sDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function HasDescription(): bool
|
||||
{
|
||||
return utils::IsNotNullOrEmptyString($this->sDescription);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function SetDescription(string $sDescription)
|
||||
{
|
||||
$this->sDescription = $sDescription;
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// iUIBlock implementation
|
||||
//-------------------------------
|
||||
|
||||
@@ -117,11 +117,13 @@ class TabContainer extends UIContentBlock
|
||||
* @param string $sTabCode
|
||||
* @param string $sTitle
|
||||
* @param string|null $sPlaceholder
|
||||
* @param string|null $sDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab
|
||||
* @throws \Combodo\iTop\Application\UI\Base\UIException
|
||||
* @since 3.1.0 N°5920 Add $sDescription argument
|
||||
*/
|
||||
public function AddAjaxTab(string $sTabCode, string $sTitle, ?string $sPlaceholder = null): Tab
|
||||
public function AddAjaxTab(string $sTabCode, string $sTitle, ?string $sPlaceholder = null, ?string $sDescription = null): Tab
|
||||
{
|
||||
if($sPlaceholder === null){
|
||||
$sPlaceholder = AjaxTab::DEFAULT_TAB_PLACEHOLDER;
|
||||
@@ -134,13 +136,15 @@ class TabContainer extends UIContentBlock
|
||||
/**
|
||||
* @param string $sTabCode
|
||||
* @param string $sTitle
|
||||
* @param string|null $sDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab
|
||||
* @throws \Combodo\iTop\Application\UI\Base\UIException
|
||||
* @since 3.1.0 N°5920 Add $sDescription argument
|
||||
*/
|
||||
public function AddTab(string $sTabCode, string $sTitle): Tab
|
||||
public function AddTab(string $sTabCode, string $sTitle, ?string $sDescription = null): Tab
|
||||
{
|
||||
$oTab = new Tab($sTabCode, $sTitle);
|
||||
$oTab = new Tab($sTabCode, $sTitle, $sDescription);
|
||||
$this->AddSubBlock($oTab);
|
||||
return $oTab;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user