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

Add support for normalizers in question API. #3

Closed
wants to merge 1 commit into from

Conversation

weitzman
Copy link
Contributor

@weitzman weitzman commented Jun 9, 2017

This PR is used by drush-ops/drush#2802.

In general, the question API we offer for generators (a long array) might be getting unweildy. Perhaps we should expect (wrapped?) Symfony Question objects. That can be a future PR.

@Chi-teck
Copy link
Owner

I agree the question array is unwieldy even without nomalizers. I shall deliberate on turning it into object.

@Chi-teck
Copy link
Owner

Chi-teck commented Jun 10, 2017

Here is an experiment with wrapped Symfony question object.
https://github.com/Chi-teck/drupal-code-generator/tree/generator-question

That can accept questions as follows:

$questions['name'] = new Question('Name', 'Example');

@weitzman
Copy link
Contributor Author

Excellent.

@Chi-teck
Copy link
Owner

Chi-teck commented Jun 11, 2017

Merged generator-question into master.

Array syntax for questions is still supported but limited to two values.

$questions['name'] = ['Name', 'Example'];

For setting other properties object syntax is required.

$questions['name'] = new Question('Name', 'Example');
$questions['name']->setValidator($validator);
$questions['name']->setAutocompleterValues($suggestions);
$questions['name']->setNormalizer($normalizer);

Closing the PR as it has become outdated.
Thanks.

@Chi-teck Chi-teck closed this Jun 11, 2017
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

Successfully merging this pull request may close these issues.

2 participants