Skip to content

Update dialog helper docs to add 2.3 features #2571

Closed
@wouterj

Description

@wouterj

As of 2.3, the DialogHelper::select method accepts multiselect by using comma seperated values:

$dialog = $app->getHelperSet()->get('dialog');
$colors = array('red', 'blue', 'yellow');

$selected = $dialog->select(
    $output,
    'Please select your favorite color (default to red)',
    $colors,
    0,
    false,
    'Value "%s" is invalid',
    true // multiselect support is disabled by default
);

$selectedColors = array_map(funtion($c) use ($colors) {
    return $colors[$c];
}, $selected)

$output->writeln('You have just selected: ' . implode(', ', $selectedColors));

Now, when a user inputs 1,2, the result will be "You have just selected: blue, yellow".

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConsoleactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions