mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
Allow Select options to be disabled
This commit is contained in:
@@ -20,6 +20,8 @@ class SelectOption extends UIBlock
|
||||
protected $sLabel;
|
||||
/** @var bool */
|
||||
protected $bSelected;
|
||||
/** @var bool */
|
||||
protected $bDisabled;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
@@ -76,6 +78,25 @@ class SelectOption extends UIBlock
|
||||
{
|
||||
$this->bSelected = $bSelected;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsDisabled(): bool
|
||||
{
|
||||
return $this->bDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bDisabled
|
||||
*
|
||||
* @return SelectOption
|
||||
*/
|
||||
public function SetDisabled(bool $bDisabled): SelectOption
|
||||
{
|
||||
$this->bDisabled = $bDisabled;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,8 @@ class SelectOptionUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
$oInput->SetValue($sValue)
|
||||
->SetLabel($sLabel)
|
||||
->SetSelected($bSelected);
|
||||
->SetSelected($bSelected)
|
||||
->SetDisabled(false);
|
||||
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
|
||||
{# @license http://opensource.org/licenses/AGPL-3.0 #}
|
||||
<option id="{{ oUIBlock.GetId() }}" value="{{ oUIBlock.GetValue() }}" {% if oUIBlock.IsSelected() %}selected{% endif %}>{{ oUIBlock.GetLabel() }}</option>
|
||||
<option id="{{ oUIBlock.GetId() }}" value="{{ oUIBlock.GetValue() }}" {% if oUIBlock.IsSelected() %}selected{% endif %} {% if oUIBlock.IsDisabled() %}disabled{% endif %}>{{ oUIBlock.GetLabel() }}</option>
|
||||
|
||||
Reference in New Issue
Block a user