mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Add UIBlocks to twig (Spinner)
This commit is contained in:
@@ -84,6 +84,8 @@ class Alert extends UIContentBlock
|
||||
public const DEFAULT_IS_COLLAPSIBLE = true;
|
||||
/** @var bool Default value for static::$bIsOpenedByDefault */
|
||||
public const DEFAULT_IS_OPENED_BY_DEFAULT = true;
|
||||
/** @var bool Default value for static::$bIsHidden */
|
||||
public const DEFAULT_IS_HIDDEN = false;
|
||||
|
||||
/** @var string $sTitle */
|
||||
protected $sTitle;
|
||||
@@ -93,6 +95,8 @@ class Alert extends UIContentBlock
|
||||
protected $bIsClosable;
|
||||
/** @var bool Whether the alert can be collapsed or not */
|
||||
protected $bIsCollapsible;
|
||||
/** @var bool Whether the alert is hidden or not */
|
||||
protected $bIsHidden;
|
||||
/** @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 */
|
||||
@@ -116,6 +120,7 @@ class Alert extends UIContentBlock
|
||||
$this->bIsClosable = static::DEFAULT_IS_CLOSABLE;
|
||||
$this->bIsCollapsible = static::DEFAULT_IS_COLLAPSIBLE;
|
||||
$this->bIsOpenedByDefault = static::DEFAULT_IS_OPENED_BY_DEFAULT;
|
||||
$this->bIsHidden = static::DEFAULT_IS_HIDDEN;
|
||||
if (!empty($sContent)) {
|
||||
$this->AddSubBlock(new Html($sContent));
|
||||
}
|
||||
@@ -275,4 +280,25 @@ class Alert extends UIContentBlock
|
||||
{
|
||||
return $this->sSectionStateStorageKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsHidden(): bool
|
||||
{
|
||||
return $this->bIsHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bIsHidden
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsHidden(bool $bIsHidden)
|
||||
{
|
||||
$this->bIsHidden = $bIsHidden;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class Input extends AbstractInput
|
||||
|
||||
public const INPUT_HIDDEN = 'hidden';
|
||||
|
||||
protected $bChecked = false;
|
||||
protected $bIsChecked = false;
|
||||
|
||||
/** @var string */
|
||||
protected $sType;
|
||||
@@ -47,9 +47,9 @@ class Input extends AbstractInput
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetChecked($bChecked)
|
||||
public function SetIsChecked($bIsChecked)
|
||||
{
|
||||
$this->bChecked = $bChecked;
|
||||
$this->bIsChecked = $bIsChecked;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,6 @@ class Input extends AbstractInput
|
||||
*/
|
||||
public function IsChecked()
|
||||
{
|
||||
return $this->bChecked;
|
||||
return $this->bIsChecked;
|
||||
}
|
||||
}
|
||||
51
sources/application/UI/Base/Component/Spinner/Spinner.php
Normal file
51
sources/application/UI/Base/Component/Spinner/Spinner.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Spinner;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
* Class Spinner
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Spinner
|
||||
*/
|
||||
class Spinner extends UIBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-spinner';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/spinner/layout';
|
||||
|
||||
protected $bIsHidden;
|
||||
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->bIsHidden = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
public function IsHidden(): bool
|
||||
{
|
||||
return $this->bIsHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param false $bIsHidden
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsHidden(bool $bIsHidden)
|
||||
{
|
||||
$this->bIsHidden = $bIsHidden;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Spinner;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
public const UI_BLOCK_CLASS_NAME = "Combodo\\iTop\\Application\\UI\\Base\\Component\\Spinner\\Spinner";
|
||||
public const TWIG_TAG_NAME = 'UISpinner';
|
||||
|
||||
public static function MakeStandard(?string $sId = null)
|
||||
{
|
||||
return new Spinner($sId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user