mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°3565 - Migrate backoffice pages to new UIBlock system : Setup
This commit is contained in:
@@ -37,6 +37,7 @@ class Title extends UIBlock
|
||||
protected $sIconUrl;
|
||||
/** @var string How the icon should cover the medallion, see static::ENUM_ICON_COVER_METHOD_COVER, static::ENUM_ICON_COVER_METHOD_ZOOMOUT */
|
||||
protected $sIconCoverMethod;
|
||||
protected $bIsMedallion;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
@@ -48,6 +49,7 @@ class Title extends UIBlock
|
||||
$this->iLevel = $iLevel;
|
||||
$this->sIconUrl = null;
|
||||
$this->sIconCoverMethod = static::DEFAULT_ICON_COVER_METHOD;
|
||||
$this->bIsMedallion = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,10 +68,12 @@ class Title extends UIBlock
|
||||
return $this->iLevel;
|
||||
}
|
||||
|
||||
public function SetIcon(string $sIconUrl, string $sIconCoverMethod = self::DEFAULT_ICON_COVER_METHOD)
|
||||
public function SetIcon(string $sIconUrl, string $sIconCoverMethod = self::DEFAULT_ICON_COVER_METHOD, bool $bIsMedallion = true)
|
||||
{
|
||||
$this->sIconUrl = $sIconUrl;
|
||||
$this->sIconCoverMethod = $sIconCoverMethod;
|
||||
$this->bIsMedallion = $bIsMedallion;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -88,4 +92,12 @@ class Title extends UIBlock
|
||||
return !is_null($this->sIconUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsMedallion(): bool
|
||||
{
|
||||
return $this->bIsMedallion;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,17 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
return new Title($sTitle, 1, $sId);
|
||||
}
|
||||
|
||||
public static function MakeForPageWithIcon(
|
||||
string $sTitle, string $sIconUrl, string $sIconCoverMethod = Title::DEFAULT_ICON_COVER_METHOD, bool $bIsMedallion = true,
|
||||
?string $sId = null
|
||||
)
|
||||
{
|
||||
$oTitle = new Title($sTitle, 1, $sId);
|
||||
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
|
||||
|
||||
return $oTitle;
|
||||
}
|
||||
|
||||
public static function MakeForObjectDetails(DBObject $oObject, ?string $sId = null)
|
||||
{
|
||||
// TODO 3.0.0: Refactor all of this
|
||||
|
||||
Reference in New Issue
Block a user