Skip to content
Snippets Groups Projects
Commit b68d7ed1 authored by Henrique Mendes's avatar Henrique Mendes Committed by Henrique Mendes
Browse files

Issue #3227314 by Mauro_, hmendes, irinaz, andregp, j-vee, daften, gbirch,...

Issue #3227314 by Mauro_, hmendes, irinaz, andregp, j-vee, daften, gbirch, lucienchalom: Checkbox-fields are unchecked when editing nodes with multi-value checkbox List-fields
parent 26d2168d
No related branches found
No related tags found
No related merge requests found
......@@ -79,8 +79,8 @@ class Buttons extends ElementBase {
* The select or other element.
*/
protected static function addEmptyOption(array &$element) {
if (!isset($element['#no_empty_option']) || !$element['#no_empty_option']) {
if (!$element['#multiple'] && !$element['#required'] && !empty($element['#default_value'])) {
if ((!isset($element['#no_empty_option']) || !$element['#no_empty_option']) && !$element['#multiple']) {
if (!$element['#required'] && !empty($element['#default_value'])) {
$element['select']['#options'] = ['' => t('- None -')] + $element['select']['#options'];
}
else {
......
......@@ -73,7 +73,6 @@ class ButtonsElementTest extends UnitTestBase {
$expected_element = array_merge_recursive($base_expected_element, [
'select' => [
'#type' => 'checkboxes',
'#value' => [],
],
'other' => [
'#states' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment