Skip to content

DropdownCascade does not have multiple values support #2125

@mkrecek234

Description

@mkrecek234

DropdownCascade disables multiplesupport. This can be easily activated if we change the DropdownCascade's getJsValues function to:

/**
     * Will mark current value as selected from a list
     * of possible values.
     *
     * @param string|int $value the current field value
     */
    private function getJsValues(array $values, $value): array
    {
        foreach ($values as $k => $v) {
            if (!$this->multiple) {
                if ($v['value'] === $value) {
                    $values[$k]['selected'] = true;

                    break;

                }
            } else {
                if (in_array($v['value'], explode(',', $value))) {
                    $values[$k]['selected'] = true;
                }

            }
        }

        return $values;
    }

Plus we have to remove line

$this->multiple = false;

Happy to submit via PR, but unfortunately can only provide a demo example, but no behat test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions