8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Following up on symfony/symfony#36484 (comment) I'm starting to collect some ideas here.
@HeahDude I don't think that https://symfony.com/doc/current/form/create_custom_field_type.html is the right place, for two reasons:
ChoiceType
finishView()
So I'm suggesting to add a page called "How to Add Information to Individual Radio Buttons" to the list at https://symfony.com/doc/current/forms.html#learn-more under "Advanced Features"
Taking the example from https://symfony.com/doc/current/reference/forms/types/choice.html#advanced-example-with-objects the code would look like this:
$builder->add('category', ChoiceType::class, [ 'choices' => $this->categoryRepository->findAll(), 'choice_value' => 'id', 'choice_label' => 'name', 'choice_name' => 'id', ]); public function finishView(FormView $view, FormInterface $form, array $options) { foreach($this->categoryRepository->findAll() as $category) { $view['category'][$category->getId()]->vars['more_info'] = $category->getMoreInfo(); } }
Add something like this to {% block checkbox_radio_label -%} in your form theme:
{% block checkbox_radio_label -%}
{%- if more_info is defined %} {{ more_info }} {% endif -%}
Questions:
finishView
The text was updated successfully, but these errors were encountered:
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
Sorry, something went wrong.
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3
Hey,
I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!
No branches or pull requests
Following up on symfony/symfony#36484 (comment) I'm starting to collect some ideas here.
@HeahDude I don't think that https://symfony.com/doc/current/form/create_custom_field_type.html is the right place, for two reasons:
ChoiceType
withfinishView()
So I'm suggesting to add a page called "How to Add Information to Individual Radio Buttons" to the list at https://symfony.com/doc/current/forms.html#learn-more under "Advanced Features"
Taking the example from https://symfony.com/doc/current/reference/forms/types/choice.html#advanced-example-with-objects the code would look like this:
Add something like this to
{% block checkbox_radio_label -%}
in your form theme:Questions:
finishView
again? There's no easier way than iterating over all of them?The text was updated successfully, but these errors were encountered: