Skip to content

Update choice_attr.rst.inc #8346

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

Merged
merged 1 commit into from
May 22, 2018
Merged

Update choice_attr.rst.inc #8346

merged 1 commit into from
May 22, 2018

Conversation

flip111
Copy link
Contributor

@flip111 flip111 commented Sep 4, 2017

@flip111
Copy link
Contributor Author

flip111 commented Sep 4, 2017

Considering putting the callable and propertypath option before the array in the sentence because:

  1. nicer flow of the sentence
  2. i would personally recommend it over specifying the attributes for each choice.

In hindsight i prefer this

Use this to add additional HTML attributes to each choice. This can be a callable, a property path (just like choice_label_) or an associative array where the keys match the choice keys and the values are the options for each choice.

@xabbuh xabbuh added this to the 2.7 milestone Sep 4, 2017
@flip111
Copy link
Contributor Author

flip111 commented Sep 7, 2017

I have a question which could go into an issue, but since i'm working on this part of the docs anyway i might as well put it here.

if choices are like

    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),

What's then $value, $key, $index in the callback? I guess for the first element it's

value -> true
key -> Yes
index -> Yes

What's the purpose of index here? whatever it is, it's not explained in the docs. I can change this part too.

Another question ... also related: is it possible to get the current data here somehow? I like the attribute of one choice to depends on true/false of the other choices, more specifically i want to check if at least 1 is true.

@javiereguiluz
Copy link
Member

@HeahDude maybe you can review this proposed change related to forms? Thanks!

of attributes (if they are the same for each choice), a callable or a property path
Use this to add additional HTML attributes to each choice. This can be
an associative array where the keys match the choice keys and the values
are the options for each choice, a callable or a property path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] the attributes for each [...]

@javiereguiluz
Copy link
Member

Thanks for this ... and sorry for having taken so long to merge it.

@javiereguiluz javiereguiluz merged commit 2691504 into symfony:2.7 May 22, 2018
javiereguiluz added a commit that referenced this pull request May 22, 2018
This PR was merged into the 2.7 branch.

Discussion
----------

Update choice_attr.rst.inc

symfony/symfony#24088

Commits
-------

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

Successfully merging this pull request may close these issues.

4 participants