mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°3564 Alert and CollapsibleSectionState can now be saved
This commit is contained in:
@@ -21,6 +21,7 @@ namespace Combodo\iTop\Application\UI\Base\Component\Alert;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Class Alert
|
||||
@@ -96,6 +97,10 @@ class Alert extends UIBlock
|
||||
protected $bIsCollapsible;
|
||||
/** @var bool Whether the alert is opened by default or not, only works when $bIsCollapsible set to true */
|
||||
protected $bIsOpenedByDefault;
|
||||
/** @var boolean if true will store collapsible state */
|
||||
protected $bIsSaveCollapsibleStateEnabled = false;
|
||||
/** @var string localStorage key used to store collapsible state */
|
||||
protected $sSectionStateStorageKey;
|
||||
|
||||
/**
|
||||
* Alert constructor.
|
||||
@@ -116,6 +121,20 @@ class Alert extends UIBlock
|
||||
parent::__construct($sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sSectionStateStorageKey
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function EnableSaveCollapsibleState($sSectionStateStorageKey)
|
||||
{
|
||||
$this->bIsSaveCollapsibleStateEnabled = true;
|
||||
$sSectionStateStorageKeyPrefix = utils::GetConfig()->GetItopInstanceid();
|
||||
$this->sSectionStateStorageKey = $sSectionStateStorageKeyPrefix.'/'.$sSectionStateStorageKey;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -247,4 +266,14 @@ class Alert extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function IsSaveCollapsibleStateEnabled(): bool
|
||||
{
|
||||
return $this->bIsSaveCollapsibleStateEnabled;
|
||||
}
|
||||
|
||||
public function GetSessionCollapsibleStateStorageKey(): string
|
||||
{
|
||||
return $this->sSectionStateStorageKey;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user