Getting user input before applying a recipe

Created on 6 August 2024, 5 months ago
Updated 21 August 2024, 4 months ago

Problem/Motivation

As outlined in ✨ Make it possible for recipes to prompt for input values Fixed , recipe authors would like a way to allow them to collect input from an admin when they are applying a recipe.

Examples are

  1. What is the site email address? API keys, URLs, etc...
  2. Which languages do you want to enable when turning on translation?

Proposed resolution

Extend the API changes in ✨ Make it possible for recipes to prompt for input values Fixed to allow for collecting input during the recipe application process

The proposed implementation will allow input definitions like this:

input:
  langcode:
    source: console
    method: choice # This can be any method of \Symfony\Component\Console\Style\StyleInterface that returns a value.
    arguments: # The arguments to the given method, by name
      question: 'What language do you want to use?'
      choices: [English, Mandarin, Klingon]
      default: English
  color:
    source: console
    method: ask
    arguments:
      question: What is your favorite color?
      validator: '\Drupal\Core\Recipe\ConsoleInputValidator::notEmpty' # This can be anything that Drupal can resolve as a callable
✨ Feature request
Status

Closed: duplicate

Version

11.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States thejimbirch Cape Cod, Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024