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

[generate:plugin:block] Options can not be generated in no-interaction mode #3975

Open
viveksr2 opened this issue Nov 2, 2018 · 2 comments · May be fixed by #4032
Open

[generate:plugin:block] Options can not be generated in no-interaction mode #3975

viveksr2 opened this issue Nov 2, 2018 · 2 comments · May be fixed by #4032

Comments

@viveksr2
Copy link

viveksr2 commented Nov 2, 2018

Problem/Motivation

When generating block with fields like checkboxes, radio or combo, options need to be passed to the command. However, as the field info is separated by comma(,) thus the options get separated in-appropriately, thus broken code is generated.

Details to include:

  • The extraction of input parameters is done in ArrayInputTrait inside explodeInlineArray() method.

How to reproduce

Run following command and observe the form definition in the generated code.

drupal --no-interaction generate:plugin:block --module=TestModule --class=HeadingBlock --label=headingblock --plugin-id=headingblock --inputs='"name":"gender","type":"radio","label":"Gender","options":"array("male" => "Male", "female" => "Female")"'

Solution

Pipe separated options should be allowed. In block.html.twig template, options are rendered as it is, however they should be processed and an array should be generated.

@LOBsTerr
Copy link
Member

LOBsTerr commented Nov 7, 2018

@viveksr2 yes, you are right. I think pipe solution can help here and rest can be done in the twig. We just need to adapt the parser method

@hjuarez20 hjuarez20 linked a pull request May 13, 2019 that will close this issue
@enzolutions
Copy link
Contributor

This fix was solved with #4032, but, will be included in Drupal Console 2.0 because of breaks compatibility with previews releases 1.x.

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

Successfully merging a pull request may close this issue.

3 participants