mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Add UIBlocks to twig (Use sub-blocks for alerts and fields)
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Alert;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
* Class Alert
|
||||
@@ -29,7 +30,7 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Alert
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class Alert extends UIBlock
|
||||
class Alert extends UIContentBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-alert';
|
||||
@@ -86,8 +87,6 @@ class Alert extends UIBlock
|
||||
|
||||
/** @var string $sTitle */
|
||||
protected $sTitle;
|
||||
/** @var string $sContent The raw HTML content, must be already sanitized */
|
||||
protected $sContent;
|
||||
/** @var string $sColor */
|
||||
protected $sColor;
|
||||
/** @var bool Whether the alert can be closed or not */
|
||||
@@ -111,13 +110,15 @@ class Alert extends UIBlock
|
||||
*/
|
||||
public function __construct(string $sTitle = '', string $sContent = '', string $sColor = self::DEFAULT_COLOR, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->sTitle = $sTitle;
|
||||
$this->sContent = $sContent;
|
||||
$this->sColor = $sColor;
|
||||
$this->bIsClosable = static::DEFAULT_IS_CLOSABLE;
|
||||
$this->bIsCollapsible = static::DEFAULT_IS_COLLAPSIBLE;
|
||||
$this->bIsOpenedByDefault = static::DEFAULT_IS_OPENED_BY_DEFAULT;
|
||||
parent::__construct($sId);
|
||||
if (!empty($sContent)) {
|
||||
$this->AddSubBlock(new Html($sContent));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,21 +37,6 @@ class InputFactory
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
public static function MakeWithLabel(string $sType, string $sLabel, string $sName, string $sValue, ?string $sId = null): InputWithLabel
|
||||
{
|
||||
$oInput = new Input($sId);
|
||||
|
||||
$oInput->SetType($sType)
|
||||
->SetName($sName)
|
||||
->SetValue($sValue);
|
||||
|
||||
if (is_null($sId)) {
|
||||
$sId = $oInput->GetId();
|
||||
}
|
||||
|
||||
return new InputWithLabel($sLabel, $oInput, $sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Field component that is better adapter when dealing with a standard iTop form
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user