diff --git a/sources/application/UI/Base/Component/Button/Button.php b/sources/application/UI/Base/Component/Button/Button.php index af3606680..d0b38d79e 100644 --- a/sources/application/UI/Base/Component/Button/Button.php +++ b/sources/application/UI/Base/Component/Button/Button.php @@ -77,6 +77,8 @@ class Button extends UIBlock protected $sJsCode; /** @var string $sOnClickJsCode */ protected $sOnClickJsCode; + /** @var bool $bIsDisabled */ + protected $bIsDisabled; /** * Button constructor. @@ -102,6 +104,7 @@ class Button extends UIBlock $this->sJsCode = $sJsCode; $this->sOnClickJsCode = $sOnClickJsCode; $this->aDataAttributes = ['role' => 'ibo-button']; + $this->bIsDisabled = false; } /** @@ -240,4 +243,24 @@ class Button extends UIBlock return $this; } + + /** + * @return bool + */ + public function IsDisabled() + { + return $this->bIsDisabled; + } + + /** + * @param bool $bIsDisabled + * + * @return $this + */ + public function SetIsDisabled(bool $bIsDisabled) + { + $this->bIsDisabled = $bIsDisabled; + + return $this; + } } \ No newline at end of file diff --git a/sources/application/UI/Base/Component/Button/ButtonJS.php b/sources/application/UI/Base/Component/Button/ButtonJS.php index b4261e489..ba2a0d079 100644 --- a/sources/application/UI/Base/Component/Button/ButtonJS.php +++ b/sources/application/UI/Base/Component/Button/ButtonJS.php @@ -48,8 +48,6 @@ class ButtonJS extends Button protected $sName; /** @var string $sValue The HTML value of the button, used by forms */ protected $sValue; - /** @var bool $bIsDisabled */ - protected $bIsDisabled; /** * ButtonJS constructor. @@ -78,7 +76,6 @@ class ButtonJS extends Button $this->sName = $sName; $this->sValue = $sValue; $this->sType = $sType; - $this->bIsDisabled = false; } /** @@ -137,25 +134,4 @@ class ButtonJS extends Button $this->sValue = $sValue; return $this; } - - - /** - * @return bool - */ - public function IsDisabled() - { - return $this->bIsDisabled; - } - - /** - * @param bool $bIsDisabled - * - * @return $this - */ - public function SetIsDisabled(bool $bIsDisabled) - { - $this->bIsDisabled = $bIsDisabled; - return $this; - } - } \ No newline at end of file diff --git a/templates/base/components/button/layout.html.twig b/templates/base/components/button/layout.html.twig index 08766336b..190395b95 100644 --- a/templates/base/components/button/layout.html.twig +++ b/templates/base/components/button/layout.html.twig @@ -6,6 +6,7 @@ data-{{ sName }}="{{ sValue }}" {% endfor %} {% endif %} + {% if oUIBlock.IsDisabled() %} disabled {% endif %} {# Visual tooltip... #} {% if oUIBlock.GetTooltip() is not empty %} data-tooltip-content="{{ oUIBlock.GetTooltip() }}"