N°3573 - Allow disabling buttons

This commit is contained in:
Eric
2021-06-30 17:03:22 +02:00
parent 94f662c71a
commit ff760dacbe
3 changed files with 24 additions and 24 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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() }}"