mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8689 from jinjie/fix-checkbox-disabled-items
Fix for CheckboxSetField not disabling items correctly
This commit is contained in:
commit
7cb8256fa0
@ -72,6 +72,7 @@ class CheckboxSetField extends MultiSelectField
|
|||||||
{
|
{
|
||||||
$selectedValues = $this->getValueArray();
|
$selectedValues = $this->getValueArray();
|
||||||
$defaultItems = $this->getDefaultItems();
|
$defaultItems = $this->getDefaultItems();
|
||||||
|
$disabledItems = $this->getDisabledItems();
|
||||||
|
|
||||||
// Generate list of options to display
|
// Generate list of options to display
|
||||||
$odd = false;
|
$odd = false;
|
||||||
@ -84,7 +85,7 @@ class CheckboxSetField extends MultiSelectField
|
|||||||
$extraClass .= ' val' . preg_replace('/[^a-zA-Z0-9\-\_]/', '_', $itemValue);
|
$extraClass .= ' val' . preg_replace('/[^a-zA-Z0-9\-\_]/', '_', $itemValue);
|
||||||
|
|
||||||
$itemChecked = in_array($itemValue, $selectedValues) || in_array($itemValue, $defaultItems);
|
$itemChecked = in_array($itemValue, $selectedValues) || in_array($itemValue, $defaultItems);
|
||||||
$itemDisabled = $this->isDisabled() || in_array($itemValue, $defaultItems);
|
$itemDisabled = $this->isDisabled() || in_array($itemValue, $disabledItems);
|
||||||
|
|
||||||
$options->push(new ArrayData(array(
|
$options->push(new ArrayData(array(
|
||||||
'ID' => $itemID,
|
'ID' => $itemID,
|
||||||
|
Loading…
Reference in New Issue
Block a user