Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropdownCascade does not have multiple values support #2125

Open
mkrecek234 opened this issue Nov 2, 2023 · 2 comments
Open

DropdownCascade does not have multiple values support #2125

mkrecek234 opened this issue Nov 2, 2023 · 2 comments

Comments

@mkrecek234
Copy link
Contributor

mkrecek234 commented Nov 2, 2023

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.

@mvorisek
Copy link
Member

mvorisek commented Nov 3, 2023

should be solved as part of #1020

@mvorisek
Copy link
Member

PR welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants