askHidden prompt fails with "Unknown named parameter $default"

Created on 4 April 2025, about 2 months ago

Problem/Motivation

Trying my first recipe with an input and tried to use the prompt type "askHidden", which is listed as supported in \Drupal\Core\Recipe\Recipe and in https://git.drupalcode.org/project/distributions_recipes/-/blob/1.0.x/do....

However when attempting to apply a recipe, an error is displayed.

Error: Unknown named parameter $default in /var/www/html/webroot/core/lib/Drupal/Core/Recipe/ConsoleInputCollector.php on line 105
#0 /var/www/html/webroot/core/lib/Drupal/Core/Recipe/InputConfigurator.php(154): Drupal\Core\Recipe\ConsoleInputCollector->collectValue()
#1 /var/www/html/webroot/core/lib/Drupal/Core/Recipe/RecipeCommand.php(76): Drupal\Core\Recipe\InputConfigurator->collectAll()
#2 /var/www/html/vendor/symfony/console/Command/Command.php(279): Drupal\Core\Recipe\RecipeCommand->execute()
#3 /var/www/html/vendor/symfony/console/Application.php(1076): Symfony\Component\Console\Command\Command->run()
#4 /var/www/html/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand()
#5 /var/www/html/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRun()
#6 /var/www/html/webroot/core/scripts/drupal(32): Symfony\Component\Console\Application->run()
#7 {main}

Steps to reproduce

  • Prepare a Drupal installation.
  • Add a directory recipes/askhidden
  • Add a recipe.yml
  • ddev ssh
  • Run cd web
  • Run php core/scripts/drupal recipe ../recipes/askhidden -v

I used the following minimal recipe to reproduce.

name: 'Ask Hidden Test'
description: 'Provides a minimal example for askHidden prompt.'
type: 'Test'

input:
  foo:
    data_type: string
    description: 'Foo'
    prompt:
      method: askHidden
      arguments:
        question: 'What is foo?'
    default:
      source: value
      value: 'bar'

config:
  strict: false

Omitting arguments or trying to provide arguments.default does not matter. The same error is thrown.

Switching to "ask" works.

Proposed resolution

Remaining tasks

- Determine if this needs improved documentation or unimplemented functionality that is documented as functional. There does not seem to be any documentation about how to use askHidden in Drupal core. In Symfony,

User interface changes

No

Introduced terminology

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

recipe system

Created by

πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

Live updates comments and jobs are added and updated live.
  • Documentation

    Primarily changes documentation, not code. For Drupal core issues, select the Documentation component instead of using this tag. In general, component selection is preferred over tag selection.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024