mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 16:22:20 +02:00
Add UIBlocks to twig (Generalize IsHidden parameter)
This commit is contained in:
@@ -84,8 +84,6 @@ 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;
|
||||
@@ -95,8 +93,6 @@ 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 */
|
||||
@@ -120,7 +116,6 @@ 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));
|
||||
}
|
||||
@@ -280,25 +275,4 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -32,8 +32,6 @@ class Field extends UIContentBlock
|
||||
/** @var string */
|
||||
protected $sAttLabel;
|
||||
/** @var bool */
|
||||
protected $bIsHidden = false;
|
||||
/** @var bool */
|
||||
protected $bIsReadOnly = false;
|
||||
/** @var bool */
|
||||
protected $bIsMandatory = false;
|
||||
@@ -143,26 +141,6 @@ class Field extends UIContentBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsHidden(): bool
|
||||
{
|
||||
return $this->bIsHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bIsHidden
|
||||
*
|
||||
* @return Field
|
||||
*/
|
||||
public function SetIsHidden(bool $bIsHidden)
|
||||
{
|
||||
$this->bIsHidden = $bIsHidden;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -20,32 +20,8 @@ class Spinner extends UIBlock
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ abstract class UIBlock implements iUIBlock
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = null;
|
||||
/** @var array JS_FILES_REL_PATH Relative paths (from <ITOP>/) to the JS files */
|
||||
public const DEFAULT_JS_FILES_REL_PATH = [];
|
||||
/** @var string|null JS_TEMPLATE_REL_PATH Relative path (from <ITOP>/templates/) to the JS template on dom ready*/
|
||||
/** @var string|null JS_TEMPLATE_REL_PATH Relative path (from <ITOP>/templates/) to the JS template on dom ready */
|
||||
public const DEFAULT_JS_TEMPLATE_REL_PATH = null;
|
||||
/** @var string|null Relative path (from <ITOP>/templates/) to the JS template not deferred */
|
||||
public const DEFAULT_JS_LIVE_TEMPLATE_REL_PATH = null;
|
||||
@@ -55,6 +55,8 @@ abstract class UIBlock implements iUIBlock
|
||||
public const DEFAULT_CSS_FILES_REL_PATH = [];
|
||||
/** @var string|null CSS_TEMPLATE_REL_PATH Relative path (from <ITOP>/templates/) to the CSS template */
|
||||
public const DEFAULT_CSS_TEMPLATE_REL_PATH = null;
|
||||
/** @var bool Default value for $bIsHidden */
|
||||
public const DEFAULT_IS_HIDDEN = false;
|
||||
|
||||
/** @var string ENUM_BLOCK_FILES_TYPE_JS */
|
||||
public const ENUM_BLOCK_FILES_TYPE_JS = 'js';
|
||||
@@ -80,8 +82,10 @@ abstract class UIBlock implements iUIBlock
|
||||
protected $aJsFilesRelPath;
|
||||
/** @var array */
|
||||
protected $aCssFilesRelPath;
|
||||
/** @var array Array <KEY> => <VALUE> which will be output as HTML data-xxx attributes (eg. data-<KEY>="<VALUE>") */
|
||||
/** @var array Array <KEY> => <VALUE> which will be output as HTML data-xxx attributes (eg. data-<KEY>="<VALUE>") */
|
||||
protected $aDataAttributes;
|
||||
/** @var bool show or hide the current block */
|
||||
protected $bIsHidden;
|
||||
|
||||
/**
|
||||
* UIBlock constructor.
|
||||
@@ -100,6 +104,7 @@ abstract class UIBlock implements iUIBlock
|
||||
$this->sCssTemplateRelPath = static::DEFAULT_CSS_TEMPLATE_REL_PATH;
|
||||
$this->sGlobalTemplateRelPath = static::DEFAULT_GLOBAL_TEMPLATE_REL_PATH;
|
||||
$this->aDataAttributes = [];
|
||||
$this->bIsHidden = static::DEFAULT_IS_HIDDEN;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,4 +358,23 @@ abstract class UIBlock implements iUIBlock
|
||||
$this->aDataAttributes[$sName] = $sValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsHidden(): bool
|
||||
{
|
||||
return $this->bIsHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bIsHidden
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIsHidden(bool $bIsHidden)
|
||||
{
|
||||
$this->bIsHidden = $bIsHidden;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user